Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have C# dll which contains method .
I need to load this dll on runtime without adding reference and call C# method from VB.net.
Posted
Updated 3-Jul-14 22:05pm
v2
Comments
[no name] 4-Jul-14 4:01am    
Start with http://msdn.microsoft.com/en-us/library/system.reflection.assembly.load(v=vs.110).aspx

1 solution

While you can use reflection to do this, it's slow, and prone to failure: if the target DLL is removed or changed, your app will fail when it tries to use it to call the method. This is likely to be too late: you can lose user data.

It's a lot, lot better idea to use a reference: the method and it's required parameters are then checked at compile time, and it will work, or you will get a "could not be found" error when you application tries to start.

Is there a good reason for forcing yourself into reflection? It's not normally a good idea if it can be avoided.
 
Share this answer
 
Comments
prabal17 8-Mar-17 6:13am    
I agree with reflection might slow the performance.
But when a Lower level dll becomes an dependency for an Higher level dll.
a. It becomes tight coupling.
b. Chances of Dead lock if Higher level needs to be reused in lower level.

How could these cons can be solved. How could we achieve Dependency Inversion Principle?
It would be great any one can share their knowledge on this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900