Skip to content

Commit 5156a39

Browse files
committed
添加泛型约束
1 parent a048ad8 commit 5156a39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/DotNetCampus.CommandLine/CommandLinePropertyValue.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public static implicit operator bool(CommandLinePropertyValue propertyValue)
306306
/// <summary>
307307
/// 将从命令行解析出来的属性值转换为枚举值。
308308
/// </summary>
309-
public T ToEnum<T>() where T : unmanaged => _values switch
309+
public T ToEnum<T>() where T : unmanaged, Enum => _values switch
310310
{
311311
{ Count: 0 } => default,
312312
{ } values => Enum.TryParse(typeof(T), values[0], true, out var result) ? (T)result : default!,

0 commit comments

Comments
 (0)