S
Steve B.
Hi
I want to instanciate an object from a string. There is a default
constructor (no parameters).
I can easily get the Type object (it is working), but when I invoke the
"new" member, I get a "NotSupportedException".
Why does it not work ?
Type t = _assembly.GetType(
"MyClass"
); // This works, the debugger show me the instance of my type object
MyClass obj = (MyClass)t.InvokeMember(
"new",
BindingFlags.CreateInstance,
null,
null,
null
); // Throw the NotSupportedException
Thanks,
Steve
I want to instanciate an object from a string. There is a default
constructor (no parameters).
I can easily get the Type object (it is working), but when I invoke the
"new" member, I get a "NotSupportedException".
Why does it not work ?
Type t = _assembly.GetType(
"MyClass"
); // This works, the debugger show me the instance of my type object
MyClass obj = (MyClass)t.InvokeMember(
"new",
BindingFlags.CreateInstance,
null,
null,
null
); // Throw the NotSupportedException
Thanks,
Steve