Is it possible to do something like this?
Create a class and put it in an assembly, e.g
namespace some
{
public class foo{
..etc
}
Load it into the current appdomain
Assembly.LoadFrom("some.foo.dll");
Get the type out
Type t = Type.GetType("some.foo");
Basically is there anyway to get the actual type into t?
I'm not sure if I understand the question. I think you want to instantiate the type.
This calls the public default constructor:
// specify the full name and assembly name, to make sure that you get the some.foo
// from the assembly in question.
Type t = Type.GetType("some.foo, some.foo");
object instance = Activator.CreateInstance(t);
Look at the overloads to call other constructors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With