By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,673 Members | 1,268 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,673 IT Pros & Developers. It's quick & easy.

Get member name

P: n/a
Hi,
We have a long list of color name: Color.Red, Color.Green, Color.Green....
If I want to get the list of all color name (certainly by programming), how
to that ?
Thanks
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hai,

If you want to get all the color names, then you would want to get all
of the static properties on the color structure. You can use reflection to
do this:

// Get the property info instances for all static properties on the Color
structure.
PropertyInfo[] pobjInfos =
typeof(Color).GetProperties(BindingFlags.GetProper ty | BindingFlags.Public |
BindingFlags.Static);

Then, you can cycle through the property infos and get the names of the
properties.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

" #Hai" <Re**********@Mail.com> wrote in message
news:eg**************@TK2MSFTNGP10.phx.gbl...
Hi,
We have a long list of color name: Color.Red, Color.Green, Color.Green....
If I want to get the list of all color name (certainly by programming), how to that ?
Thanks

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.