Unable to get the type of an interface/class using more than one generic type?

c#, compiler-errors, generics, typeof

Solution

You need to let the compiler know that you're looking for the generic type with two generic arguments. Add a comma between the angle brackets:

var typeTwo = typeof(ITestMany<,>);

Problem

Give the example code below, can anyone explain why the first `typeof()` call works successfully but the second fails?? It doesn't matter if they are classes or interfaces it fails either way. ``` interface ITestOne<T1> { T1 MyMethod(); } interface ITestMany<T1, T2> { T1 MyMethod(T2 myParameter); } void Main() { var typeOne = typeof(ITestOne<>); //This line works var typeTwo = typeof(ITestMany<>); //Compile error } ```

Original source