LANGUAGES: All .NET Languages
ASP.NET VERSIONS: 1.0 | 1.1
Searching for .NET Classes in All the Right Places
Use WinCV to find the perfect class in the framework for the task at hand.
By Don Kiely
Have you ever been on a roll coding when, all of a sudden, you need to find the perfect class in the framework for the task at hand? If you use VS .NET, you have IntelliSense. But sometimes IntelliSense is just a bit too intelligent as it tailors the list to the current code context. It can also be quite hard to find which of many overloaded methods you actually need to use. Besides, Microsoft is fond of touting that you can write .NET apps in any kind of text editor, few of which have any kind of help like IntelliSense. So what do you do?
I usually fire up a handy tool included with the .NET Framework SDK: the Windows Forms Class Viewer, WinCV.exe. As an ASP.NET developer, I long ignored this tool because of the name. But it is actually a full .NET class viewer that exposes the entire set of framework classes or those in your own assemblies. Figure 1 shows a shot of the tool in action when I needed to look up the public interface for an ASP.NET validator control.
Figure 1. WinCV.exe exposes the entire set of framework classes or those in your own assemblies.
When you click on a class name in the Search Results list, it displays a list of the public members using a kind of C# syntax. If you're a VBer, don't worry. The syntax is quite understandable; it isn't something that you'd use directly in an application anyway. But it does give you a complete list of properties, events, and methods, along with parameter and return types. There is no direct link to intermediate language (IL) code to examine what the class does, but WinCE includes the name of the DLL file where the class is located, so you can run ildasm.exe and explore the implementation.
WinCV uses .NET reflection to grab the information, so the tool doesn't rely on Microsoft to keep any data up to date. Instead, it reads the appropriate assemblies to get the interface, and when it changes with new versions of the framework the new classes and interfaces are automatically displayed.
The beauty of WinCV is its simplicity and the kind of information you get in the right side of the window. Type any part of the class name in the Searching For box and as you type the Search Results box on the left refreshes with all of the matches. That slows things down a bit, but not to any great extent - certainly not to the point of annoyance.
The Option button in the upper right implies more power than actually included with the tool. It exposes only a "Font" option to change the display font, "Copy to Clipboard", and "Exit" to close the program.
The documentation says that you can look up information "based on a search pattern," but I haven't been able to figure out any patterns other than literal text strings. Regular expressions don't work; the tool just stops evaluating the search term when you type anything it doesn't understand. Nonetheless, it is quite useful to be able to search on any embedded strings. I can usually guess or remember enough of a class' name to find it in the search results list.
When you start up WinCV, it uses various defaults that list classes only from the System namespace, displaying only public members. You can't change that behavior with a small set of command-line options. /show lets you specify that you want to see any of the protected, private, internal, or inherited members of the interface. /hide hides any of those member types; I've yet to find a use for this option. The /nostdlib switch specifies whether to load the default assemblies of the .NET Framework.
Probably the most useful command-line switch is /r. With this switch and /nostdlib you can load only the classes in a custom assembly, essentially giving you a way to explore the interface of a custom assembly. I've used this to explore third-party .NET components without resorting to ildasm to explore its inner workings.
WinCV has been described as "IntelliSense on steroids", but I don't think of it that way. IntelliSense relies on your knowing at least the first few characters of a class' name along with some idea of its methods or properties. With WinCV, you have much more flexible options for finding an appropriate class, even though you are limited to a literal string in the name. Use it as yet another way to explore the vast world of the .NET Framework!
Don Kiely is senior technology consultant for Information Insights, a business and technology consultancy in Fairbanks, Alaska. E-mail him at mailto:[email protected].