Compartilhar via


Find Type Class Browser Application Sample

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This sample demonstrates a command-line interface that provides information about types in their environments. This sample provides a simple way for a developer to determine what types are available, what modules they are in, and what interfaces, methods, fields, properties, and events are available on each type. This sample also demonstrates reflection, which is the process of obtaining information about assemblies and the types defined within them, and creating, invoking, and accessing type instances at run time.

For information about using the samples, see the following topics:

To build the sample using the Command Prompt

  1. Open the Command Prompt window and navigate to one of the language-specific subdirectories under the TypeFinder directory. For information about required settings and the SDK Command Prompt, see How to: Set Sample Settings.

  2. Type msbuild TypeFinderCS.sln or msbuild TypeFinderVB.sln, depending on your choice of programming language.

To build the sample using Visual Studio

  1. Open Windows Explorer and navigate to one of the language-specific subdirectories under the TypeFinder directory.

  2. Double-click the icon for the TypeFinderCS.sln or TypeFinderVB.sln, depending on your choice of programming language, to open the file in Visual Studio.

  3. On the Build menu, select Build Solution.

The FindType.exe application will be created in the default \bin subdirectory.

To run the sample

  1. In the Command Prompt window, navigate to the subdirectory that contains the FindType.exe application.

  2. Type FindType.exe [word] at the command prompt to find the location of each type with a specific word in it. For example, navigate to the bin directory containing the application and type FindType.exe String. A list of types with the word "String" in them is displayed.

For a complete list of options for this sample application, and examples of how to use it, type FindType.exe at the command prompt.

Note

The sample is a console application. You must launch it from the command line to view its output.

Remarks

This sample uses the following technologies and classes.

  • Reflection

    • Assembly - Loads assemblies into the AppDomain so that they can be searched for types.

    • Module - Gets types from the Assembly or Module for comparison to the search string.

    • Type - Gets information about a type, such as its name, namespace, and members.

    • PropertyInfo - Provides information about properties in types.

    • EventInfo - Provides information about events in types.

    • FieldInfo - Provides information about fields in types.

    • MethodInfo - Provides information about methods in types.

  • IO

    • TextWriter - Used by the type IndentedWriter, defined in the sample, to output to the console in a generic fashion.
  • Text

    • StringBuilder - Used by the IndentedWriter sample type to create a string.

    • String - Finds strings such as format strings, sub-strings, and upper-case strings.

  • Collections

See Also

Concepts

Reflection