1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:18:47 +00:00

Add Enum constraint to string.EnumParse<T>

This commit is contained in:
Oliver Booth 2021-07-20 17:29:26 +01:00
parent af3dfaa623
commit 3bbf689db4
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4

View File

@ -105,6 +105,7 @@ namespace X10D
/// (http://geekswithblogs.net/sdorman/Default.aspx).
/// </remarks>
public static T EnumParse<T>(this string value)
where T : struct, Enum
{
return value.EnumParse<T>(false);
}
@ -121,6 +122,7 @@ namespace X10D
/// (http://geekswithblogs.net/sdorman/Default.aspx).
/// </remarks>
public static T EnumParse<T>(this string value, bool ignoreCase)
where T : struct, Enum
{
if (value is null)
{