And why doesn't it shows the real type (eg: List<string> instead of List`1)?
Where does this strange (to me) notation comes from?
The CLR name for generic List<T>
with one type parameter is
System.Collections.Generic.List`1
List<T>
is the C# style of naming that type.
The notation is a convention defined to give you the ability to overload generic types by parameter count. If you declare a class named List
with two type parameters (e.g. List<T,U>
) the compiler would be able to choose the right one. It'll be named:
System.Collections.Generic.List`2
and a non-generic List
class will be named:
System.Collections.Generic.List
Note that the CLR does not require generic types to be named like that. It's just a convention for the compilers to be able to pick the right type.
It doesn't show List<string>
because that's C# dependent syntax. A List in .Net source code could be declared as List<string>
, List(Of String)
or any of the other 60 or so languages/syntaxes that can compile down to MSIL.
So what you're seeing is the more generic MSIL syntax.
The `1 means that it is a List that has one generic parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With