IVisualizerObjectProvider.ReplaceObject 方法

命名空间:  Microsoft.VisualStudio.DebuggerVisualizers
程序集:  Microsoft.VisualStudio.DebuggerVisualizers(在 Microsoft.VisualStudio.DebuggerVisualizers.dll 中)

语法

声明
Sub ReplaceObject ( _
    newObject As Object _
)
void ReplaceObject(
    Object newObject
)
void ReplaceObject(
    Object^ newObject
)
abstract ReplaceObject : 
        newObject:Object -> unit 
function ReplaceObject(
    newObject : Object
)

参数

  • newObject
    类型:System.Object
    用来替换当前正进行可视化处理的对象的新对象。

备注

用指定的新对象替换进行可视化处理的对象。 这会导致对 newObject 参数进行序列化并将其传递给 ReplaceData 方法。

示例

public class DebuggerSide : DialogDebuggerVisualizer
{
   override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
   {
      // Get a string from the debuggee side and display it in a message box.
      String myString = objectProvider.GetObject().ToString();
      MessageBox.Show(myString);
      
      // Modify the string and send it back to the debuggee side.
      String myNewString = myString.ToUpper();
      // Make sure the object is replacable before you try to replace it.
      // Otherwise, you will get an exception.
      if (objectProvider.IsObjectReplaceable)
      {
      // This example assumes the object source is expecting a string.
         objectProvider.ReplaceObject(myNewString);
      }
   }
// Other DebuggerSide methods ommitted for clarity.
}

.NET Framework 安全性

请参见

参考

IVisualizerObjectProvider 接口

Microsoft.VisualStudio.DebuggerVisualizers 命名空间