SysAnalytics.Model/Enums/StringEnum.cs
/// <summary>
/// Gets a string value for a particular enum value.
/// </summary>
/// <param name="value">Value.</param>
/// <returns>String Value associated via a <see cref="StringValueAttribute"/> attribute, or null if not found.</returns>
Gets a string value for a particular enum value.
Gets a string value for a particular enum value .
public static string GetStringValue(Enum value)
		{
			string output = null;
			Type type = value.GetType();
			if (_stringValues.ContainsKey(value))
				output = (_stringValues[value] as StringValueAttribute).Value;
			else 
			{
				FieldInfo fi = type.GetField(value.ToString());
				StringValueAttribute[] attrs = fi.GetCustomAttributes(typeof (StringValueAttribute), false) as StringValueAttribute[];
				if (attrs.Length > 0)
				{
					_stringValues.Add(value, attrs[0]);
					output = attrs[0].Value;
				}
			}
			return output;
		}
public static string GetStringValue ( Enum value ) { string output = null ; Type type = value . GetType ( ) ; if ( _stringValues . ContainsKey ( value ) ) output = ( _stringValues [ value ] as StringValueAttribute ) . Value ; else { FieldInfo fi = type . GetField ( value . ToString ( ) ) ; StringValueAttribute [ ] attrs = fi . GetCustomAttributes ( typeof ( StringValueAttribute ) , false ) as StringValueAttribute [ ] ; if ( attrs . Length > 0 ) { _stringValues . Add ( value , attrs [ 0 ] ) ; output = attrs [ 0 ] . Value ; } } return output ; }
Gets a string value for a particular enum value.
Gets a string value for a particular enum value .
//Look for our 'StringValueAttribute' in the field's custom attributes
String Value associated via a  attribute, or null if not found.
String Value associated via a attribute or null if not found .
value
Enum
None