vendredi 23 novembre 2018

Accessing properties of generic instance which type is determined during runtime

Im coming from this link:https://docs.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/how-to-examine-and-instantiate-generic-types-with-reflection
This is my code:

Type d1 = typeof(Dictionary<,>);
Type[] typeArgs = { typeof(string), typeof(string) };
Type constructed = d1.MakeGenericType(typeArgs);
object o = Activator.CreateInstance(constructed);


My question is: How to acces methods and properties from object 'o'?





Aucun commentaire:

Enregistrer un commentaire