CSharpFeeds - All your C# feeds in one place.

Sponsors

Thursday, February 28, 2008

C# Multi-Valued Enums - Extension Method Style

by Paul Stovell via Paul Stovell on 2/28/2008 12:07:41 PM

Omar blogged a method to extract the selected values in an enumeration: http://blog.omarbesiso.net/index.php/2008/02/13/c-multi-valued-enumerators-flags/ Suppose you had an flags enumeration called Option. You could use his method to write the following code: Options options = Options.ReadOnly | Options.Archive; Console.WriteLine("You selected:"); foreach (Options option in EnumHelper.GetSelectedEnumValues<Options>(options)) { Console.WriteLine(option); } While a generic static method is fine, I think this is a good [...]

email it!bookmark it!digg it!

Original Post: C# Multi-Valued Enums - Extension Method Style

Subscribe

New Feed

Product Spotlight

Recently Updated Sources

Legal Note

The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us