語言

SerialPort.DiscardNull 屬性

定義

取得或設定一個值,指示在埠與接收緩衝區間傳輸時,空位元組是否被忽略。

public:
 property bool DiscardNull { bool get(); void set(bool value); };
public bool DiscardNull { get; set; }
[System.ComponentModel.Browsable(true)]
public bool DiscardNull { get; set; }
member this.DiscardNull : bool with get, set
[<System.ComponentModel.Browsable(true)>]
member this.DiscardNull : bool with get, set
Public Property DiscardNull As Boolean

屬性值

true 若忽略空位元組;否則 false。 預設值為 false。

屬性

例外狀況

該埠口處於無效狀態。

-或-

嘗試設定底層埠的狀態失敗。 例如,從這個 SerialPort 物件傳出的參數是無效的。

溪流已經關閉。 這可能是因為 Open() 方法尚未被呼叫,或 Close() 方法已被呼叫。

備註

此值通常應設為 false,尤其是二進位傳輸時。 將此屬性設為 可能會 true 對 UTF32 和 UTF16 編碼位元組產生意想不到的結果。

適用於