Thread: C# DLL
View Single Post
  #2 (permalink)  
Old November 30th, 2008, 10:26 PM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

To be clear the second developers project would not contain the source of the DLL, only the DLL itself. To utilize this DLL in the project the developer would right click on the project and select Add Reference and then navigate to the location to the DLL.

Once the reference is added they could do something like
using SuperCoolDLL;
namespace Foo
   public class Boo
     private void SomeMethod()
       SuperCoolDLLNamespace.SuperCoolDLLClass b = new SuperCoolDLLNamespace.SuperCoolDLLClass();
I should point out, unless there is a naming conflict between this third party assembly and the .NET Framework, you will not need to reference the class by Namespace.Class as I did above, you can simply reference the class. (If you do have a naming conflict you will need to fully qualify the class otherwise you will get a '<className> is ambiguous...' error)

Lastly, the using statement should contain the name of the namespace(s) within the DLL that you wish to use and not the name of the physical DLL.


================================================== =========
Read this if you want to know how to get a correct reply for your question:
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Reply With Quote