Scott Wojan

DotRant BLOG
posts - 21 , comments - 70 , trackbacks - 5

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 | Comments (0) |

Powered by: