mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 13:15:07 +00:00
feat: Added GetAttributeAsEnum xml utils method
This commit is contained in:
committed by
Chris Cameron
parent
e4e3e9b91a
commit
ad7176506d
@@ -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
|
#endregion
|
||||||
|
|
||||||
#region Recurse
|
#region Recurse
|
||||||
|
|||||||
Reference in New Issue
Block a user