ジェネリッククラスがあるとしましょう:
public class MyGenericClass<T> {
...
}
このクラスの中に、別のジェネリックと対話できるメソッドが必要です。これは、ジェネリック型T
または次のようなスーパークラスのいずれかT
です。
public void DoSomething<T1>(List<T1> things)
where T : T1 // of course this won't compile
{
...
}
これをどのように行いますか?