No KnownColors In NETCF

A requested feature for NETCF is to retrieve a list of named colors. Fortunately this is easily done using reflection to read all the public statis properties of the Color class:-

System.Reflection.PropertyInfo[] colors = typeof(Color).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static);
Color[] allcolors = new Color[colors.Length];

for(int i = 0; i < colors.Length; i++)
    allcolors[i] = (Color)colors[i].GetValue(null,null);

comboBox1.DataSource = allcolors;


In this example the full list is assigned to a ComboBox for display purposes.