Is possible to nest generic parameters like class MyClass<TG<TM>>{}
?
I tried some ways and got the following code that works, but the class declaration needs to receive the two parameters separated:
class MyClass1<TG, TM>
where TM : MyType
where TG : OtherType<TM> {
public TM DoSomething() {
}
public TG DoSomething2() {
}
}
Is that the only way ?
EDIT:
As you can see, I need the two generic parameters inside the class (members that use both: TM and TG), so TG is a generic parameter and cannot be a type (in that case), the answers and comments suggesting me to 'hardcode' one of the two parameters doesn't contribute to this question.
Well, with the above sample we can use it like (and works):
new MyClass<A<B>, B>();
The second parameter, in my case, would be always the same used with the nested parameter for the first parameter. So, I asked if we could omit the second parameter and the compiler infer it from the parameter of the first parameter.
Is something like that possible instead of having two separated parameters ?