Bagikan melalui


IVisualizerObjectProvider.ReplaceData(Stream) Method

Definition

Creates a replacement copy of the object based on the serialized data given.

public:
 void ReplaceData(System::IO::Stream ^ newObjectData);
public void ReplaceData (System.IO.Stream newObjectData);
abstract member ReplaceData : System.IO.Stream -> unit
Public Sub ReplaceData (newObjectData As Stream)

Parameters

newObjectData
Stream

A stream containing data to be used to create a new object, replacing the object currently 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 replaceable 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.  
}

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(Object, Stream) on the VisualizerObjectSource.The return value of the call will become the new object being visualized.

Applies to