Share via


IVisualizerObjectProvider3.TransferObject<T>(Object) Method

Definition

Serializes the outgoing object using the SelectedFormatterPolicy and then calls TransferData(Stream). Upon return it tries to deserialize the incoming data and returns the object of the specified type.

public T? TransferObject<T> (object outgoingObject);
abstract member TransferObject : obj -> 'T
Public Function TransferObject(Of T) (outgoingObject As Object) As T

Type Parameters

T

The type of the return value of TransferData(Stream).

Parameters

outgoingObject
Object

An object that is to be transferred back to the debuggee side.

Returns

T

The result of deserializing the return value of TransferData(Stream).

Examples

public class DebuggerSide : DialogDebuggerVisualizer
{
    override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
    {
        IVisualizerObjectProvider3 objectProvider3 = (IVisualizerObjectProvider3)objectProvider;

        // Get a string from the debuggee side and display it in a message box.  
        String myString = objectProvider3.GetObject<string>();
        MessageBox.Show(myString);

        // Modify the string and send it back to the debuggee side.  
        String myNewString = myString.ToUpper();
        // Make sure the object is replaceable before you try to replace it.  
        // Otherwise, you will get an exception.  
        objectProvider3.TransferObject<object>(myNewString);
    }
    // Other DebuggerSide methods omitted for clarity.  
}

Remarks

Transfers a data object back to the debuggee. Call this method after replacing the object that is being visualized. Call this method to transfer some information or call a command on the VisualizerObjectSource. This method just wraps TransferData(Stream) with calls to serialization and deserialization helper methods.

Applies to