Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I view the public API of my class library in Visual Studio?

Using the Object Browser, I see everything, public, internal, private. How can I see only the public API of my class library?

If not, is there another tool I can use to browse my class library's public API? I'm trying to get an outside-in view of my library.

like image 501
xofz Avatar asked Mar 15 '11 08:03

xofz


People also ask

What is a class library in Visual Studio?

A class library is a collection of class definitions contained in a . dll or .exe file. In order to use the class library, you must first add a reference to the library (see "How to add references to your Visual Studio Project").

How do I add a class library code in Visual Studio?

Start Visual Studio Code. In the Open Folder dialog, create a ClassLibraryProjects folder and click Select Folder (Open on macOS). Open the Terminal in Visual Studio Code by selecting View > Terminal from the main menu. The Terminal opens with the command prompt in the ClassLibraryProjects folder.


3 Answers

You can use Reflector and limit the visibility options under 'View' -> 'Options' -> 'Browser' to 'Public items only':

enter image description here

like image 148
oɔɯǝɹ Avatar answered Sep 25 '22 02:09

oɔɯǝɹ


In the object browser to filter only public items on an individual class. This doesn't filter the left hand pane of the browser so you still see private types there.

Object browser filtering

You can also use the ILDASM tool that ships with the Windows SDK. This gives a bunch more filtering options and filters things from the tree fiew completely. It's really a disassembly viewer to it's not as pretty.

ILDASM

You can download the SDK from here: http://msdn.microsoft.com/en-us/windows/bb980924

It will install in: C:\Program Files\Microsoft SDKs\Windows\v7.1\bin\NETFX 4.0 Tools\ildasm.EXE

You can also use Reflector. This used to be free but now seems to be a paid product that will uninstall the free version when it updates. IMO reflector is the best tool for this but only if you feel like buying it. It starts at $35 for the basic version http://www.reflector.net/.

like image 41
Ade Miller Avatar answered Sep 27 '22 02:09

Ade Miller


By referencing the class library in another project, when I view it in that Object Browser, it shows the public API only.

like image 32
xofz Avatar answered Sep 24 '22 02:09

xofz