6 changed files with 26 additions and 23 deletions
@ -0,0 +1,19 @@ |
|||
using System; |
|||
|
|||
namespace Avalonia |
|||
{ |
|||
internal class EnumParserHelper |
|||
{ |
|||
#if NET6_0
|
|||
public static T ParseEnum<T>(ReadOnlySpan<char> key, bool ignoreCase) where T : struct |
|||
{ |
|||
return Enum.Parse<T>(key, ignoreCase); |
|||
} |
|||
#else
|
|||
public static T ParseEnum<T>(string key, bool ignoreCase) where T : struct |
|||
{ |
|||
return (T)Enum.Parse(typeof(T), key, ignoreCase); |
|||
} |
|||
#endif
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue