I’m reading information from an XML which contains the type of an object that I need to instantiate along with it’s constructor parameters.
The object type is actually in another project, within a sibling namespace. (I need to create a Company.Project2.Type within Company.Project1 class.)
I found this question, but it doesn’t handle the constructor parameters or the fact that it’s in another namespace.
How can I do this?
Edit: The assembly name and default namespace wasn’t set correctly in the project properties.
Type.GetType(), including namespace, e.g. ‘Company.Project2.Type’Company.Project2.dll, you might specify ‘Company.Project2.Type, Company.Project2’.Activator.CreateInstance(Type, Object[])or get the exact constructor you want withType.GetConstructor()and then callConstructorInfo.Invoke().If that doesn’t help, please give more information.