CreateObject in C#

Hi, does anybody know how to create object in C#. In vb.net I know its simply:

myObj = CreateObject("Object")

but how do you do the same in c#. I know there is Server.CreateObject but I am not writing an ASP.NET app, it is a windows application. I have to late bind unfortunately because I dont know what dll to reference to create the object that I need. Some help would be much appreciated.

Thanks



Answer this question

CreateObject in C#

  • MartinDolphin

    hmm, what about

    object o = new object();

  • Silvercat

    Thanks, that seemed to sort it out.


  • thechristopher


    Activator.CreateInstance(Type.GetTypeFromProgID("object"));


     



  • Ivan Scattergood

    The CreateObject method in VB creates a COM object, that's something different than the .NET object.

  • Sjefsmoen

    Why don't you add a reference to visual basic dll and use the same function in c#, remember all managed code and cross talk

  • CreateObject in C#