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

(#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

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);
}