I have a List
of strings
which contains UserControl
classes. I wish to pass that List
to a foreach()
loop and create an object
of each class
in the List
List<string> MyUserControlList= new List<string>();
Permissions.Add("Profile_UC");
Permissions.Add("Bio_UC");
foreach(var Information in MyUserControlList)
{
//Getting Usercontrol class name
Type uc1 = Type.GetType(Information);
// Type uc1 = Type.GetType("Tab_Control_and_User_Control_test."+Permission,Assembly.GetEntryAssembly().GetName().Name);
//Creating instance of relative user control class
Object MyUserControlObject = Activator.CreateInstance(uc1);
//rest of my logic
}
I searched and find that its kind of an assembly issue, but I didn't find any good resource to point out it in a dynamic way.