山东飞鸿建设集团网站,甘肃省住房和建设厅网站首页,西宁专业做网站公司,最新互联网平台项目上周为了快速了解一个.NET的库而需要查看其类型层次。假如要在文章中表示一个类型层次#xff0c;还是用文本比较舒服#xff0c;截图始终是不方便。Reflector虽然能够显示类型层次#xff0c;但我无法方便的把显示出来的类型层次转换为文本形式。而且#xff0c;Reflector…上周为了快速了解一个.NET的库而需要查看其类型层次。假如要在文章中表示一个类型层次还是用文本比较舒服截图始终是不方便。Reflector虽然能够显示类型层次但我无法方便的把显示出来的类型层次转换为文本形式。而且Reflector在显示基类和派生类的时候都会使用类型的全名但有时候我只需要看到类型的简单名字。我也找过另外几个工具例如.NET Framework SDK以前自带的Windows 窗体类查看器(Wincv.exe)但它只显示类型自身的信息以及基类的信息而不显示派生类的信息还是不够用。没找到现成合用的工具只好自己写一个了。于是就用C#/WinForms写了一个简单的GUI程序只是用来显示类型层次信息并且能把类型层次以文本形式复制到剪贴板。截图一张对应这张截图得到的文本表示IListCollectionKeyedCollectionListReadOnlyCollection开源形式该程序采用MIT形式的许可证开放源代码。程序与源码可在下面链接的压缩包中获得。下载地址运行环境由于使用了LINQ这个程序需要.NET Framework 3.5才能正常运行。如果需要移植到.NET Framework 2.0的话可以使用Mono的System.Core.dll的实现。使用方法可以从命令行提供参数来打开assembly格式为ClassHierarchyViewer 或者直接启动程序并通过以下三种方式的任意一种来打开assembly1、在文本框中输入assembly的完整名称(Name,Version,Culture,PublicKeyToken)并按回车或点击“Load By Name”按钮2、按“Open File...”按钮通过对话框选取assembly3、从文件浏览器把assembly拖放到该程序的窗口里。同一时间只会有一个assembly显示在窗口中。其它功能应该不言而喻了我就直接把readme文件的内容帖出来吧Name: ClassHierarchyViewerAuthor: RednaxelaFX (Kris Mok,rednaxela0607hotmail.com)Version: 0.3.0.1Release Date: 2008-09-23License: 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 .NET Framework 3.5 or above installed.Usage:1. Start program from command line:usage: ClassHierarchyViewer - or -2. Start program from GUI:Assemblies can be loaded by one of:* enter the assemblys full name in the combobox, then clickLoad By Name button;* enter the assemblys full name in the combobox, and hitEnter;* Click Open File... button, and choose an assembly file;* Drag and drop a assembly file from Explorer.Only one assembly is active at a time.A few commonly used BCL assemblies names are added to thecombox already, including:mscorlib, Version2.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System, Version2.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.AddIn, Version3.5.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Configuration, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Core, Version3.5.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Data, Version2.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Data.Entity, Version3.5.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Data.Linq, Version3.5.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Deployment, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Design, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.DirectoryServices, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Drawing, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Drawing.Design, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Messaging, Version2.0.0.0, Cultureneutral, PublicKeyToken969db8053d3322acSystem.Net, Version3.5.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.ServiceModel, Version3.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Web, Version2.0.0.0, Cultureneutral, PublicKeyTokenb03f5f7f11d50a3aSystem.Windows.Forms, Version2.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089System.Xml, Version2.0.0.0, Cultureneutral, PublicKeyTokenb77a5c561934e089Functions:The GUI window is divided into 3 major components:1. Class List Window (on the left)Displays all types (except ) in the given assembly,grouped by their namespaces, sorted by the types name.Types that are not visible outside the assembly are marked gray.2. Class Hierarchy Window (on the upper right)When a type is selected in the Class List Window, its typehierarchy will be shown in this window.The hierarchy shown includes the type itself, its base type (upto System.Object), and all its derived types.Checking/unchecking the Full Name checkbox will cause thiswindow to reload, showing types with their simple name/full name.Clicking Copy to Clipboard button will copy the type hierarchyto the clipboard, in text representaion.3. Class Member Window (on the lower right)When a type is selected in the Class Hierarchy Window, itsmembers will be shown in this window. This does not includea types nested types.Checking/unchecking the Use Alias checkbox will cause thiswindow to reload, showing types with their alias/name.Known Issues:1. TreeViews flicker when mouse moves over them rapidly.Havent found any solution to this, maybe thats just howWinForms behaves.2. Copying the type hierarchy causes flickering.This is because of the way data is loaded: derived types areadded onto the tree when a node is expanded. To make surederived types are added correctly, the whole tree is expandedbefore its text representation can be gathered. This will beimproved in later versions with M-V-VM pattern.3. Properties getter and setter methods arent associated withthe properties nodes.Due to the lack of developing time, certain useful functionssuch as this one is not implemented yet. Will be fixed inlater versions.4. Doesnt show what interfaces a type implements.Same as above. Will be fixed.5. Cannot load an assembly from GAC just by browsing in the openfile dialog.I know. Thats why theres an alternative, to load assemblieswith their full names. Later on I might add a dialog to selectassemblies from GAC.Note:The icons used in this program originated from Microsoft VisualStudio 2008s image libraries, Visual Studio Image Library:24bit Objects and Objects (WinVista style, .png).[/quote]许可证The MIT LicenseCopyright (c) 2008 RednaxelaFX (Kris Mok,rednaxela0607hotmail.com)Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the Software), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.现在这个简陋的程序最大的限制就是无法自如的打开GAC里的assembly因为在Windows上安装.NET Framework之后GAC目录默认会被Fusion管理起来需要通过修改注册表来禁用这个功能才能看到GAC里的assembly的路径。当然我可以扫描%WINDOWS%\Assembly\下的所有assembly不过这个功能还没做进来别的类似程序在扫描GAC时非常慢所以我不太肯定要不要把这个功能做进来。现在通过强名称一样能打开GAC里的assembly只是用户会辛苦一点了。预先放在文本框的下拉列表里的名称应该能满足一般使用需要了吧。如果有什么意见和建议欢迎提出。有需要请通过站内短信或者电子邮件联系谢谢 ^ ^