更新时间:2022-05-17 22:16:52
不,没有办法在类型约束。
No, there's no way of doing an "or" in type constraints.
在我看来,你真的想要一个重载,它是一个值类型约束的泛型,一个是nongeneric但是有一个字符串参数。你实际上不能指定一个密封类的类型约束。
It seems to me that you really want one overload which is generic with a value type constraint, and one which is nongeneric but has a string parameter. You can't actually specify a type constraint of a sealed class anyway.