Если вы реализуете универсальный метод расширения для универсального класса, есть ли лучший способ?
Потому что было бы естественно вызвать func2 точно как func1
, а не func2
, т.е. опустить параметр T и называть его как func2
public class A<T> where T : class {
public V func1<V>() {
//func1 has access to T and V types
}
}
public static class ExtA {
// to implement func1 as extension method 2 generic parameters required
// and we need to duplicate constraint on T
public static V func2<T, V>(this A<T> instance) where T : class {
// func2 has access to V & T
}
}