src/openSourceC.DotNetLibrary.Core/Extensions/AttributeExtensions.cs
/// <summary>
///		Gets value of the <see cref="T:XmlEnumAttribute"/> for the specified enumerator
///		member.
/// </summary>
/// <param name="enumerator">The enumerator value.</param>
/// <returns>
///		The value of the <see cref="T:XmlEnumAttribute"/> for the specified enumerator
///		member if it exists; otherwise, the lowercase value of the member name.
/// </returns>
Gets value of the  for the specified enumerator
member.
Gets value of the for the specified enumerator member .
public static string GetXmlEnum(this Enum enumerator)
		{
			object? attribute = enumerator.GetType().GetField(enumerator.ToString())?.GetCustomAttributes(typeof(XmlEnumAttribute), true).SingleOrDefault();
			if (attribute is XmlEnumAttribute xmlEnumAttribute && xmlEnumAttribute.Name is not null)
			{
				return xmlEnumAttribute.Name;
			}
			return enumerator.ToString().ToLowerInvariant();
		}
public static string GetXmlEnum ( this Enum enumerator ) { object ? attribute = enumerator . GetType ( ) . GetField ( enumerator . ToString ( ) ) ? . GetCustomAttributes ( typeof ( XmlEnumAttribute ) , true ) . SingleOrDefault ( ) ; if ( attribute is XmlEnumAttribute xmlEnumAttribute && xmlEnumAttribute . Name is not null ) { return xmlEnumAttribute . Name ; } return enumerator . ToString ( ) . ToLowerInvariant ( ) ; }
Gets value of the  for the specified enumerator
member.
Gets value of the for the specified enumerator member .
The value of the  for the specified enumerator
member if it exists; otherwise, the lowercase value of the member name.
The value of the for the specified enumerator member if it exists ; otherwise the lowercase value of the member name .
Enum
this
enumerator
The enumerator value.
The enumerator value .