jeudi 20 avril 2017

.NET Framework: Get Type from TypeInfo

The new reflection API introduces the TypeInfo class: http://ift.tt/1V61KCF

I can get a TypeInfo instance of a Type (say, a Car) by writing

TypeInfo typeInfo = typeof(Car).GetTypeInfo();

Now, what if I just have a TypeInfo instance, how do I get the Type its refering to? Can I just write

Type type = typeInfo.GetType();

Or will this return a type that is equal to typeof(TypeInfo)?





Aucun commentaire:

Enregistrer un commentaire