vendredi 7 juillet 2017

C# Reflection create instance of the class with boolean parameter

I have a class which takes Boolean parameter in the constructor :

myclass(bool flagstatus)
{
 //my code;
} 

i Am using Reflection to create an instance of this class so my code is :

   Activator.CreateInstance(Type.GetType("myclass"), true)

but this function uses the default constructor to create the class . Is there a way where i can pass Boolean parameter in the constructor using reflection C#





Aucun commentaire:

Enregistrer un commentaire