views:

865

answers:

6

After someone creates a DLL in C# using the Microsoft Visual development environment, how would another programmer take that code, make a new project that includes the DLL's source and make a GUI that uses the DLL'S API?

I have already done the following four steps:

1) In the Solution Explorer right-click "References" and select "Add Reference ...".

2) Select the "Browse" tab.

3) Navigate to the DLL and select it.

4) Add the appropriate "using" directive to the top of the code.

What is next? After I declare a new object, how do I see what methods to use?

+1  A: 

You should be able to use intellisense and the object explorer as always. Without the source that will be your best bet.

Ed Swangren
+5  A: 

View Menu -> Object Browser

You should be able to look at the objects/methods and so on contained in the DLL and publicly exposed.

Quintin Robinson
A: 

Well...

Suppose your library is called MyLib.DLL

You would do:

MyLib ml = new MyLib();
ml.YourMethodsShouldAppearHere(); //If they are public of course.

;)

Martín Marconcini
+1  A: 

I don't have any code off the top of my head but have you investigated the Reflection library? You should be able to figure out and run everything you need with that...

Lancelot
A: 

You can open any .NET DLL in this 3rd party tool called ".NET Reflector". This tool will allow you to view all the types/methods/properties and even decompile the code contained in the DLL.

.NET Reflector is similar to the object browser in Visual Studio, but is way more powerful.

If you haven't tried Reflector yet, I highly recommend it (it's really easy to use)!

Andy White
+1  A: 

you can load the DLL via the .NET Reflector tool from red-gate and see all of the api and even how it was implemented http://www.red-gate.com/products/reflector/

Jon Erickson