I was looking for a way to get an alternate value from an enum, and referenced this answer
Here it uses a description attribute to assign a value and then a method for extracting that as so
public static string DescriptionAttr<T>(this T source) { FieldInfo fi = source.GetType().GetField(source.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) return attributes[0].Description; else return source.ToString(); }
Only I'm unfortunately stuck in the dark ages with .net 3.5 Compact Framework, and do not appear to have access to System.ComponentModel.DescriptionAttribute
Might anyone give me a hint how to get something like this working...