共用方式為


IVisualizerObjectProvider3.TransferObject<T>(Object) 方法

定義

使用 SelectedFormatterPolicy 序列化傳出物件,然後呼叫 TransferData(Stream)。 傳回時,它會嘗試還原串行化傳入數據,並傳回指定型別的物件。

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

類型參數

T

傳回值的 TransferData(Stream)型別。

參數

outgoingObject
Object

要傳送回偵錯範圍端的物件。

傳回

T

還原串行化 的 TransferData(Stream)傳回值的結果。

範例

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.  
}

備註

將數據物件傳送回偵錯範圍。 取代正在可視化的對象之後,請呼叫這個方法。 呼叫這個方法以傳輸某些資訊,或呼叫 上的 VisualizerObjectSource命令。 這個方法只會包裝 TransferData(Stream) 對串行化和還原串行化協助程式方法的呼叫。

適用於