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()); } }
public static String Description(this ElementErrorCodes value, String message) { return(String.Format("{0}{1}{2}", Description(value), Environment.NewLine, message)); }
public ElementException(ElementErrorCodes errorCode, String message) : base(errorCode.Description(message)) { ErrorCode = errorCode; }