public static Run_Case.Constraint GetMatchingCon(this Enum @enum) { Run_Case.Constraint value = Run_Case.Constraint.Value; var fieldInfo = @enum.GetType().GetField(@enum.ToString()); var attrs = fieldInfo.GetCustomAttributes(typeof(MenuCodeAttribute), false) as MenuCodeAttribute[]; if (attrs != null) { value = attrs.Length > 0 ? attrs[0].MatchingCon : Run_Case.Constraint.Value; } return(value); }
public MenuCodeAttribute(string menuCode, Run_Case.Constraint matchingC) : this(menuCode) { MatchingCon = matchingC; }