Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SerialPort.DiscardNull Property

Gets or sets a value indicating whether null bytes are ignored when transmitted between the port and the receive buffer.

Namespace: System.IO.Ports
Assembly: System (in system.dll)

public bool DiscardNull { get; set; }
/** @property */
public boolean get_DiscardNull ()

/** @property */
public void set_DiscardNull (boolean value)

public function get DiscardNull () : boolean

public function set DiscardNull (value : boolean)

Not applicable.

Property Value

true if null bytes are ignored; otherwise false. The default is false.
Exception typeCondition

IOException

The port is in an invalid state.

- or -

An attempt to set the state of the underlying port failed. For example, the parameters passed from this SerialPort object were invalid.

InvalidOperationException

The stream is closed. This can occur because the Open method has not been called or the Close method has been called.

This value should normally be set to false, especially for binary transmissions. Setting this property to true can cause unexpected results for UTF32- and UTF16-encoded bytes.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

.NET Compact Framework

Supported in: 2.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.