Can reflection be used internally to create a class instance based on an input string containing the class name? Something somewhat similar to the code below however typeof takes a type as an argument, not a string.
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. // Some dll public abstract class InstanceCreator { public static InstanceCreator GetObject(string type) { return typeof(type); // return type with name corresponding to input string } } public class SomeClass1 { } public class SomeClass2 { } // end some dll =================================== 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