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:
parent
3d44132865
commit
af3dfaa623
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user