This topic has not yet been rated - Rate this topic

IVisualizerObjectProvider.ReplaceObject Method 

Namespace: Microsoft.VisualStudio.DebuggerVisualizers
Assembly: Microsoft.VisualStudio.DebuggerVisualizers (in microsoft.visualstudio.debuggervisualizers.dll)

void ReplaceObject (
	Object newObject
)
void ReplaceObject (
	Object newObject
)
function ReplaceObject (
	newObject : Object
)

Parameters

newObject

The new object to replace the object currently being visualized.

Replaces the object being visualized with a new object that you specify. This results in the newObject parameter being serialized and passed to the ReplaceData method.

Replaces the object being visualized with a new object that you specify. This results in the newObject parameter being serialized and passed to the ReplaceData method.

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.
}
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.
}
Did you find this helpful?
(1500 characters remaining)
Advertisement