Reputation: 16178
I have following code in C#
class c<T> { }
class d<T,E> { }
void Main()
{
Console.WriteLine(typeof(c<>).FullName); // works
Console.WriteLine(typeof(d<>).FullName); // CS0305 Using the generic type d<T, E> requires 2 type parameters
}
edit:
Console.WriteLine(typeof(d<int, int>).GetGenericTypeDefinition().FullName);
I expect:
c`1
d`2
does what I want, but I don't want to specify any types during compilation.
How to get GenericTypeDefinition
for type d
?
Upvotes: 0
Views: 88