Q:

Select item id by item name

I get all Brushes colors
var colorNames = typeof(Brushes)
                    .GetProperties(BindingFlags. Static | BindingFlags. Public)
                    .Select(x => x.Name);

How can I get color index where color name is "Black"? 
Why I can't go this way colorNames. FirstOrDefault(color => color. Name == "Black").Id;? 
Edit: I use colorNames for DropDown data, I need index of certain color to set it as default DropDown value. 

A:

Try this to return the index of the color that is Black, use this query:
var colors = typeof(Brushes)
                .GetProperties(BindingFlags. Static | BindingFlags. Public)
                .ToList();

var index = colors. FindIndex(color => color. Name == "Black");

After testing this, I get the value of 8 for the index of the color which is Black

