Markus
Markus

Reputation: 19

Using unknown dll in a c# project

I have got a dll from another program on my computer. According to its name it could have the functionality that I need for my own c# project. It seems to be also made with c#.

Is it possible to find out the functions in it and use them?

Upvotes: 0

Views: 1353

Answers (5)

sa_ddam213
sa_ddam213

Reputation: 43616

You can just reference the dll you want in your project and use Object Browser to see what Methods etc you can access.

Step 1: Add reference

enter image description here

Step 2: Choose dll

enter image description here

Step 3: View in Object Browser

enter image description here

Step 4: Browse Library

enter image description here

Step 5: Find what you need

Happy Coding :)

Upvotes: 1

Brad Christie
Brad Christie

Reputation: 101614

Visual Studio provides the Object Browser if you want insight about a DLL (for those written in .NET involving IL).

screenshot of object browser http://blogs.msdn.com/resized-image.ashx/__size/550x0/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-65-29/4774.wmob04.jpg
Borrowed from this msdn blog

However, if you need more control or want the ability to not only include the library but view the source (in most instances) and step through it (debugging), I suggest grabbing .NET Reflector.

Upvotes: 2

svick
svick

Reputation: 244948

If it really is a C# DLL, then you can add it as a reference to your project and then use the Object Browser to see what namespaces and classes it contains.

Upvotes: 0

David Heffernan
David Heffernan

Reputation: 613302

If it is a C# DLL then you can add a reference and use it. If it is a native DLL then you'd need to do some reverse engineering.

However, what you are describing is not the normal way to do about developing software. To write decent software you need to have good documentation for the libraries that you use. Trying to guess how a library is meant to be called is a recipe for disaster. Development should be based on a solid and deep understanding of the tools you are using.

Upvotes: 3

David L
David L

Reputation: 33833

Absolutely! If you can add it as a reference by right-clicking your project references, clicking add reference, and then browsing to it, it should be compatible with the version of .NET that you are using. At that point, try to instantiate it and see if you can go to definition on the instantiation. Crude but an effective way to get used to using external dlls.

Upvotes: 0

Related Questions