feat: Added GetAttributeAsEnum xml utils method

This commit is contained in:
Rashod Davis
2018-11-28 11:28:11 -05:00
committed by Chris Cameron
parent e4e3e9b91a
commit ad7176506d

View File

@@ -145,6 +145,21 @@ namespace ICD.Common.Utils.Xml
}
}
/// <summary>
/// Gets the value of the attribute with the given name and returns as a bool.
/// </summary>
/// <param name="xml"></param>
/// <param name="name"></param>
/// <param name="ignoreCase"></param>
/// <returns></returns>
[PublicAPI]
public static T GetAttributeAsEnum<T>(string xml, string name, bool ignoreCase)
where T : struct, IConvertible
{
string attribute = GetAttributeAsString(xml, name);
return EnumUtils.Parse<T>(attribute, ignoreCase);
}
#endregion
#region Recurse