建立 managed 物件的自訂視圖 (c #、Visual Basic、F #、c + +/CLI) Create custom views of managed objects (C#, Visual Basic, F#, C++/CLI)

您可以自訂 Visual Studio 在偵錯工具變數視窗中顯示資料型別的方式。You can customize the way Visual Studio displays data types in debugger variable windows.

屬性Attributes

在 c #、Visual Basic、F # 和 c + + 中 (c + +/CLI 程式碼僅) ,您可以使用、和來加入自訂資料的擴充 DebuggerTypeProxyAttribute DebuggerDisplayAttribute DebuggerBrowsableAttributeIn C#, Visual Basic, F#, and C++ (C++/CLI code only), you can add expansions for custom data using DebuggerTypeProxyAttribute, DebuggerDisplayAttribute, and DebuggerBrowsableAttribute.

在 .NET Framework 2.0 程式碼中,Visual Basic 不支援 DebuggerBrowsable 屬性。In .NET Framework 2.0 code, Visual Basic does not support the DebuggerBrowsable attribute. 這項限制已在較新版本的 .NET 中移除。This limitation is removed in more recent versions of .NET.

視覺化工具Visualizers

您可以撰寫視覺化檢視以顯示任何 Managed 資料型別。You can write a visualizer to display any managed data type. 如需詳細資訊,請參閱 how to:撰寫視覺化程式。For more information, see How to: Write a Visualizer.

注意

針對 c + + 程式碼,您可以使用 Natvis 架構加入自訂資料類型展開,如在 偵錯工具中建立 c + + 物件的自訂視圖所述。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