0

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?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Markus
  • 19
  • 3

5 Answers5

3

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
2

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.

Brad Christie
  • 100,477
  • 16
  • 156
  • 200
  • There is no free version of Reflector, only trial version. There are several free decompilers, like dotPeek available. And for this, you don't even need a decompiler. – svick Jan 21 '13 at 21:45
  • @Brad Christie. Using .NET reflector in this case is like killing a fly with a bazooka. I think your second point is the best solution in this case. – Cédric Bignon Jan 21 '13 at 21:46
1

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 :)

sa_ddam213
  • 42,848
  • 7
  • 101
  • 110
0

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.

David L
  • 32,885
  • 8
  • 62
  • 93
0

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.

svick
  • 236,525
  • 50
  • 385
  • 514