例如,我有一个 ( non-static) 类Foo<T>
我想添加一个方法bar(),Foo但是这个方法应该只适用于Foo<int>。
因为我们不能重载类型约束,
我是否必须在单独的static类中创建扩展方法bar(this Foo<int> myFoo)?
例如,我有一个 ( non-static) 类Foo<T>
我想添加一个方法bar(),Foo但是这个方法应该只适用于Foo<int>。
因为我们不能重载类型约束,
我是否必须在单独的static类中创建扩展方法bar(this Foo<int> myFoo)?