For example, if you run the following code...
Type IListType = new List<string>().GetType()
.GetInterface("IList`1")
.GetGenericTypeDefinition();
...and you watch IListType
variable, you'll find that the whole Type
instance has all properties available like FullName
and others.
But what happens when you run the code bellow?
Type IListType2 = typeof(List<>).GetInterface("IList`1")
Now IListType
got from a generic type definition isn't the same as the first code sample: most Type
properties will return null.
The main issue with this is that IListType == IListType2
doesn't equal while they're the same type.
What's going on?
Aucun commentaire:
Enregistrer un commentaire