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

[443 byte] By [GBez] at [2007-12-16]
# 1


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


DanielRieck at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
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
TimDinh at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
hmm, what about

object o = new object();

StephaneHamel at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 4

Thanks, that seemed to sort it out.

GBez at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 5
The CreateObject method in VB creates a COM object, that's something different than the .NET object.
DanielRieck at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified