foreach(var color in typeof(Brushes)
.GetProperties(BindingFlags.Static | BindingFlags.Public))
{
var currentColor = color.GetValue(null) as Brush;
}
If you only need color names, you can use LINQ:
var colorNames = typeof (Brushes)
.GetProperties(BindingFlags.Static | BindingFlags.Public)
.Select(x => x.Name);
source
share