Share via


IVisualizerObjectProvider.ReplaceData Method

Namespace:  Microsoft.VisualStudio.DebuggerVisualizers
Assembly:  Microsoft.VisualStudio.DebuggerVisualizers (in Microsoft.VisualStudio.DebuggerVisualizers.dll)

Syntax

'Declaration
Sub ReplaceData ( _
    newObjectData As Stream _
)
void ReplaceData(
    Stream newObjectData
)
void ReplaceData(
    Stream^ newObjectData
)
abstract ReplaceData : 
        newObjectData:Stream -> unit
function ReplaceData(
    newObjectData : Stream
)

Parameters

  • newObjectData
    Type: System.IO.Stream

    A stream containing data to be used to create a new object, replacing the object currently being visualized.

Remarks

Replaces the contents of the object being visualized with the contents of the data stream you specify. Sends the contents of the stream parameter to the ObjectSource class, for that class to do anything it needs with it.

Calling this method results in a call to CreateReplacementObject on the VisualizerObjectSource. The return value of the call will become the new object being visualized.

Examples

public class DebuggerSide : DialogDebuggerVisualizer
{
   override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
   {
      Stream myStream = objectProvider.GetData();
      Stream myNewStream;
      // Here is where you would show the visualizer and deserialize
      // Make sure the object is replacable before you try to replace 
      // it. Otherwise, you will get an exception.
      if (objectProvider.IsObjectReplaceable)
      {
       // Reserialize here
       objectProvider.ReplaceData(myNewStream); 
      }
   }
   // Other class methods would be here.
}

.NET Framework Security

See Also

Reference

IVisualizerObjectProvider Interface

Microsoft.VisualStudio.DebuggerVisualizers Namespace