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 [...]
Original Post: C# Multi-Valued Enums - Extension Method Style
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.