Last week to get a quick look at one. NET and need to look at its type hierarchy. If you want to express a type level in the article, or the text is more comfortable, is always inconvenient. Although the reflector can display the type hierarchy, I cannot conveniently convert the displayed type hierarchy to textual form. Also, Reflector uses the full name of the type when displaying both the base class and the derived class, but sometimes I just need to see the simple name of the type. I've also looked for other tools, such as the Windows Forms Class Viewer (Wincv.exe) that came with the. NET Framework SDK, but it shows only the information of the type itself and the information of the base class, not the information of the derived class, or not.
Did not find ready-made tools, had to write a. So I wrote a simple GUI program with C#/winforms, just to display the type hierarchy information and to copy the type hierarchy to the Clipboard in text form.
A picture:
Corresponds to this resulting text representation:
Java code
- Ilist<t>
- Collection<t>
- Keyedcollection<tkey, titem>
- List<t>
- Readonlycollection<t>
===========================================================================
Open source Form:
The program uses the MIT form of the license open source code. The program and source code can be obtained in the compressed package of this post attachment.
Operating Environment:
Because of the use of LINQ, this program requires the. NET Framework
3.5To run correctly. If you need to migrate to the. NET Framework 2.0, you can use the System.Core.dll implementation of Mono.
===========================================================================
How to use:
You can supply parameters from the command line to open assembly, in the format:
Classhierarchyviewer <assembly-path>
Or start the program directly and open the Assembly in one of the following three ways:
1. Enter the full name of the assembly in the text box (Name,version,culture,publickeytoken) and press Enter or click on the "Load by Name" button;
2. Press the "Open File ..." button to select assembly from the dialog box;
3. Drag and drop assembly from the file browser into the window of the program.
Only one assembly will appear in the window at the same time.
Other functions should be self-evident, I will directly put the contents of the Readme file:
Reference////////////////////////////////////////////////////////////////
Name:classhierarchyviewer
Author:rednaxelafx (Kris Mok, [email protected])
version:0.3.0.1
Release date:2008-09-23
License:mit style License. See License.txt.
////////////////////////////////////////////////////////////////
Description:
A simple tool that shows the class hierarchy within a given
. NET Assembly.
Required Environment:
Windows XP or Vista, with the. NET Framework 3.5 or above installed.
////////////////////////////////////////////////////////////////
Usage:
1. Start program from command line:
Usage:classhierarchyviewer <assembly-path>
-OR-
2. Start program from GUI:
Assemblies can loaded by one of:
* Enter the assembly ' full name in the ComboBox and then click
"Load by Name" button;
* Enter the assembly ' s full name in the ComboBox, and hit
Enter;
* Click "Open File ..." button, and choose an assembly File;
* Drag and drop a assembly file from Explorer.
Only one assembly are active at a time.
A few commonly used BCL assemblies ' names is added to the
Combox already, including:
mscorlib, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.AddIn, version=3.5.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Configuration, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.core, version=3.5.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Data, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Data.Entity, version=3.5.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Data.Linq, version=3.5.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Deployment, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.Design, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.DirectoryServices, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.Drawing, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.Drawing.Design, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.Messaging, version=2.0.0.0, Culture=neutral, PUBLICKEYTOKEN=969DB8053D3322AC
System.Net, version=3.5.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.ServiceModel, version=3.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Web, version=2.0.0.0, Culture=neutral, publickeytoken=b03f5f7f11d50a3a
System.Windows.Forms, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
System.Xml, version=2.0.0.0, Culture=neutral, publickeytoken=b77a5c561934e089
////////////////////////////////////////////////////////////////
Functions:
The GUI window is divided to 3 major components:
1. Class List Window (on the left)
Displays all types (except "<Module>") in the given assembly,
Grouped by their namespaces, sorted by the type ' s name.
Types that is not visible outside the assembly is marked Gray.
2. Class Hierarchy Window (on the upper right)
When a type was selected in the Class List Window, its type
Hierarchy'll is shown in the This window.
The hierarchy shown includes the type itself, its base type (up
To System.Object), and all its derived types.
Checking/unchecking the "Full Name" checkbox would cause this
window to reload, showing types with their-simple name/full name.
Clicking "Copy to Clipboard" button would Copy the type hierarchy
To the Clipboard, in text representaion.
3. Class Member Window (on the lower right)
When a type was selected in the Class Hierarchy Window, its
Members would be shown in the This window. This does not include
A type ' s nested types.
Checking/unchecking the "Use Alias" checkbox would cause this
window to reload, showing types with their alias/name.
////////////////////////////////////////////////////////////////
Known Issues:
1. TreeViews flicker when mouse moves over them rapidly.
Haven ' t found any solution to this, maybe that's just how
WinForms behaves.
2. Copying The type hierarchy causes flickering.
This is because of the-the-loaded:derived types is
Added onto the tree when a node is expanded. To make sure
Derived types was added correctly, the whole tree is expanded
Before its text representation can be gathered. This would be
Improved in later versions with M-V-VM pattern.
3. Properties ' getter and setter methods aren ' t associated with
The properties ' nodes.
Due to the lack of developing time, certain useful functions
such as this one are not implemented yet. Would be a fixed in
Later versions.
4. doesn ' t show what interfaces a type implements.
Same as above. would be fixed.
5. Cannot load an assembly from GAC just by browsing in the open
File dialog.
I know. That's why there's an alternative, to load assemblies
With their full names. Later on I might add a dialog to select
Assemblies from the GAC.
////////////////////////////////////////////////////////////////
Note:
The icons used in this program originated from Microsoft Visual
Studio ' s image libraries, Visual Studio image Library:
24bit Objects and Objects (WinVista style,. png).
License:
Quote the MIT License
Copyright (c) Rednaxelafx (Kris Mok, [email protected])
Permission is hereby granted, free of charge, to all person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
In the software without restriction, including without limitation the rights
To use, copy, modify, merge, publish, distribute, sublicense, and/or sell
Copies of the software, and to permit persons to whom the software is
Furnished to does so, subject to the following conditions:
The above copyright notice and this permission notice shall is included in
All copies or substantial portions of the software.
The software is provided ' as is ', without WARRANTY of any KIND, EXPRESS OR
Implied, including but isn't LIMITED to the warranties of merchantability,
FITNESS for A particular PURPOSE and noninfringement. In NO EVENT shall the
AUTHORS or COPYRIGHT holders be liable for any CLAIM, damages or other
Liability, WHETHER in a ACTION of contract, TORT OR OTHERWISE, arising from,
Out of OR-CONNECTION with the software or the use or other dealings in
The software.
Now the biggest limitation of this humble program is the inability to open the assembly in the GAC, because the GAC directory is managed by Fusion by default after installing the. NET Framework on Windows. You need to disable this feature by modifying the registry to see the path to the assembly in the GAC. Of course, I can scan all the Assembly under the%windows%\assembly\, but this feature hasn't come in yet, and other similar programs are very slow to scan the GAC, so I'm not sure I want to do this. Now the assembly can be opened in the GAC just like a strong name, but the user will have a hard time. The name of the drop-down list that is pre-placed in the text box should be sufficient for general use.
If you have any comments and suggestions, please ask. Please contact us via SMS or email, thank you ^ ^
- Classhierarchyviewer_0.3.zip (1 MB)
- Classhierarchyviewer_0.3.0.1.zip (1 MB)
. NET Type hierarchy View tool