----- Original Message -----
From: "Bill Bassler" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 05, 2004 12:36 PM
Subject: [ADVANCED-DOTNET] Using reflection internally to create an instance
based on a string name
> ...
> Activator.CreateInstance seems to require that a reference to the
> containing .dll is obtained. I'm interested in creating an instance of a
> class defined in the same assembly as the creator method based on an input
> string that matches the class name.
> ...
Since you want a type in the same assembly as the callee, a correct
implementation would be:
public static InstanceCreator GetObject(string type)
{
return typeof(InstanceCreator).Assembly.GetType(type);
}
[]s,
Rodrigo
===================================
This list is hosted by DevelopMentor® http://www.develop.com
Some .NET courses you may be interested in:
NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at http://discuss.develop.com