任何人都可以告诉我是否有一种方法可以使用泛型来限制泛型类型参数T:
T
Int16
Int32
Int64
UInt16
UInt32
UInt64
我知道的where关键字,但无法找到一个接口只有这些类型,
where
就像是:
static bool IntegerFunction<T>(T value) where T : INumeric
c# generics constraints
c# ×1
constraints ×1
generics ×1