diff --git a/X10D/src/StringExtensions/StringExtensions.cs b/X10D/src/StringExtensions/StringExtensions.cs index c62fb9b..93bfd03 100644 --- a/X10D/src/StringExtensions/StringExtensions.cs +++ b/X10D/src/StringExtensions/StringExtensions.cs @@ -136,12 +136,16 @@ namespace X10D throw new ArgumentException(Resource.EnumParseEmptyStringException, nameof(value)); } +#if NET5_0_OR_GREATER + return Enum.Parse(value, ignoreCase); +#else if (typeof(T) is not { IsEnum: true } type) { throw new ArgumentException(Resource.EnumParseNotEnumException); } return (T)Enum.Parse(type, value, ignoreCase); +#endif } ///