DesignTimePropertyAttributes GetDesignTimePropertyAttributes(PropertyInfo propertyInfo) { DesignTimePropertyAttributes result = new DesignTimePropertyAttributes(); PrecisionAttribute numDigitsAttribute = propertyInfo.GetCustomAttribute <PrecisionAttribute>(); if (numDigitsAttribute != null) { result.NumDigits = numDigitsAttribute.NumDecimalPlaces; } DisplayTextAttribute displayTextAttribute = propertyInfo.GetCustomAttribute <DisplayTextAttribute>(); if (displayTextAttribute != null) { result.DisplayText = displayTextAttribute.DisplayText; } DependentPropertyAttribute dependentPropertyAttribute = propertyInfo.GetCustomAttribute <DependentPropertyAttribute>(); if (dependentPropertyAttribute != null) { result.DependentProperty = dependentPropertyAttribute.DependentProperty; } return(result); }
public static String AsText(this MessageLevel e) { return(DisplayTextAttribute.ToDisplayString(e)); }