Пример #1
0
 public static string GetDescription(RoleEnum role)
 {
     System.Reflection.FieldInfo oFieldInfo = role.GetType().GetField(role.ToString());
     DescriptionAttribute[]      attributes = (DescriptionAttribute[])oFieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);
     if (attributes.Length > 0)
     {
         return(attributes[0].Description);
     }
     else
     {
         return(role.ToString());
     }
 }