(#14) Pattern-match IsEnum property on typeof(T)

This commit is contained in:
Oliver Booth 2021-07-20 17:25:52 +01:00
parent 3d44132865
commit af3dfaa623
No known key found for this signature in database
GPG Key ID: A4AC17007530E9B4
1 changed files with 2 additions and 4 deletions

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -134,9 +134,7 @@ namespace X10D
throw new ArgumentException(Resource.EnumParseEmptyStringException, nameof(value));
}
var type = typeof(T);
if (!type.IsEnum)
if (typeof(T) is not { IsEnum: true } type)
{
throw new ArgumentException(Resource.EnumParseNotEnumException);
}