Reputation: 716
How do I call a DLL written in C#, from my C# main project without using the using statement
?
As in CreateObject(servername.typename[,location])
in VB.
Upvotes: 0
Views: 369
Reputation: 1874
Can you explain your scenario a bit more ? Are you creating some sort of 'plug-in' architecture, where you don't know what plug-ins will be available until runtime ? If so, yes reflection will get you to where you need to go, but there are better ways.
Upvotes: 0
Reputation: 3012
Keep the same namespace in both the DLL and main project.
Upvotes: 1
Reputation: 65554
The closest methods in the .Net framework equivalent to VB6's CreateObject call are the following:
object calcInstance = Activator.CreateInstance(calcType);
or
Assembly testAssembly = Assembly.LoadFile(@"c:\Test.dll");
Code taken from http://www.csharp-examples.net/reflection-examples/
Upvotes: 1