Reflecting on Generic Types
When you call Type.GetType() in order to obtain metadata descriptions of generic types, you must
make use of a special syntax involving a “back tick” character (`) followed by a numerical value
that represents the number of type parameters the type supports. For example, if you wish to print
out the metadata description of List, you would need to pass the following string into your
application:
System.Collections.Generic.List`1
Here, we are using the numerical value of 1, given that List has only one type parameter.
However, if you wish to reflect over Dictionary, you would supply the value 2:
System.Collections.Generic.Dictionary`2
Do'stlaringiz bilan baham: |