示例#1
0
 public static String Description(this ElementErrorCodes value)
 {
     try
     {
         var fi         = value.GetType().GetField(value.ToString());
         var attributes = (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);
         return(attributes.Length > 0 ? attributes[0].Description : value.ToString());
     }
     catch
     {
         return(value.ToString());
     }
 }
示例#2
0
 public static String Description(this ElementErrorCodes value, String message)
 {
     return(String.Format("{0}{1}{2}", Description(value), Environment.NewLine, message));
 }
示例#3
0
 public ElementException(ElementErrorCodes errorCode, String message) : base(errorCode.Description(message))
 {
     ErrorCode = errorCode;
 }