goodmorningsky Posted October 29, 2004 Posted October 29, 2004 Hi, all I know the type of an object (Type). I want to create the object of the Type in runtime BaseClass bs = drivedClassObject; object obj = CreateObject(bs.GetType()); //the obj is the object of drivedClassObject type. //return new object of the passed type public object CreateObject(Type t){ return new object of Type t. } How can I implement CreateObject method..? Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Administrators PlausiblyDamp Posted October 29, 2004 Administrators Posted October 29, 2004 You could always call the Activator.CreateInstance method, just curious as to what you are trying to do here as there may be a better solution. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
goodmorningsky Posted October 29, 2004 Author Posted October 29, 2004 Thank you for the answer! it works.. I develop custome Object de/serialization API. Quote Sun Certified Web component Developer, Microsoft Certified Solution Developer .NET, Software Engineer
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.