Geeks With Blogs

Scott Wojan DotRant BLOG May 2012 Entries
Enum helper for values specified in attributes
I've used this enum helper from time to time to get an enum value from attributes such as Description and XmlEnumAttribute. Maybe you can find it useful? public static class EnumEx { public static T GetXmlEnumValue<T>(st... name) { var type = CheckEnum<T>(); var val = (from f in type.GetFields() let attribute = f.GetCustomAttributes(typeo... true).FirstOrDefault() as System.Xml.Serialization.Xm... where attribute != null && ......

Posted On Thursday, May 17, 2012 4:06 PM

Copyright © Scott Wojan | Powered by: GeeksWithBlogs.net