Dinusha
Dinusha

Reputation: 716

how to call dll file without using statment in c#

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

Answers (3)

sh1rts
sh1rts

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

Richard Brightwell
Richard Brightwell

Reputation: 3012

Keep the same namespace in both the DLL and main project.

Upvotes: 1

Jeremy Thompson
Jeremy Thompson

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

Related Questions