共用方式為


Create custom views of managed objects (C#, Visual Basic, F#, C++/CLI)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can customize the way Visual Studio displays data types in debugger variable windows.

Attributes

In C#, Visual Basic, F#, and C++ (C++/CLI code only), you can add expansions for custom data using DebuggerTypeProxyAttribute, DebuggerDisplayAttribute, and DebuggerBrowsableAttribute.

In .NET Framework 2.0 code, Visual Basic does not support the DebuggerBrowsable attribute. This limitation is removed in more recent versions of .NET.

Visualizers

You can write a visualizer to display any managed data type. For more information, see How to: Write a Visualizer.

Note

For C++ code, you can add custom data type expansions using the Natvis framework, as described in Create custom views of C++ objects in the debugger.

See also