有人能告訴我是否有泛型限制泛型類型參數(shù)的方法嗎?T只限于:Int16Int32Int64UInt16UInt32UInt64我知道where關鍵字,但找不到只這些類型,類似于:static bool IntegerFunction<T>(T value) where T : INumeric
3 回答

皈依舞
TA貢獻1851條經(jīng)驗 獲得超3個贊
static bool GenericFunction<T>(T value) where T : operators( +, -, /, * )
static bool GenericFunction<T>(T value) where T : Add, Subtract
struct
class
new()
INullable<T>
- 3 回答
- 0 關注
- 1250 瀏覽
添加回答
舉報
0/150
提交
取消