共用方式為


Implementing Type Visualizers and Custom Viewers

Type visualizers and custom viewers allow a user to view data of a particular type in a way that is more meaningful than a simple hexadecimal dump of numbers. An expression evaluator (EE) can associate custom viewers with specific types of data or variables. These custom viewers are implemented by the EE. The EE can also support external type visualizers, which might come from another third-party vendor or even the end user.

Discussion

Type Visualizers

Visual Studio asks for a list of type visualizers and custom viewers for every object to be displayed in a watch window. An expression evaluator (EE) supplies such a list for every type for which it wants to support type visualizers and custom viewers. Calls to IDebugProperty3::GetCustomViewerCount and IDebugProperty3::GetCustomViewerList start the whole process of accessing type visualizers and custom viewers (see Visualizing and Viewing Data for details on the calling sequence).

Custom Viewers

Custom viewers are implemented in the EE for a specific data type and are represented by the IDebugCustomViewer interface. A custom viewer is not as flexible as a type visualizer, since it is available only when the EE that implements that particular custom viewer is executing. Implementing a custom viewer is simpler than implementing support for type visualizers. However, supporting type visualizers gives maximum flexibility to the end user for visualizing his or her data. The remainder of this discussion concerns only type visualizers.

Interfaces

The EE implements the following interfaces to support type visualizers, to be consumed by Visual Studio:

The EE consumes the following interfaces to support type visualizers:

See Also

Reference

IDebugCustomViewer

Concepts

Visualizing and Viewing Data

Other Resources

Writing a Common Language Runtime Expression Evaluator