Write(dataToSend, 0, 5)
Table 9-1: Applications can use a variety of methods to write data to a SerialPort object.
9: +! 7
SerialPort Write Byte array.
Char array or subarray.
String.
yes
WriteLine String + NewLine.
NewLine only.
yes
WriteByte Byte. yes
BinaryWriter Write Byte, Byte array or subarray, SByte.
Char, Char array or subarray.
String.
Boolean, Decimal, Double, Int16, Int32, Int64,
Single, UInt16, UInt32, UInt64.
yes
StreamWriter Write Char, Char array or subarray.
String, formatted String.
Text representation of Boolean, Decimal,
Double, Int32, Int64, Object, Single, UInt32,
UInt64.
yes
WriteLine Same as Write but with NewLine appended.
NewLine only.
yes
Using .NET??™s SerialPort Class
165
Table 9-2: Applications have many choices when reading from a SerialPort object.
9: +!# 7
SerialPort Read Byte array or subarray.
Char array or subarray.
Waits for at
least 1 Byte
or Char
ReadByte Byte. yes
ReadChar Char. yes
ReadExisting String. no
ReadLine String to first NewLine. (Discards NewLine.) yes
ReadTo String to first specified Char. (Discards
specified Char.)
yes
BinaryReader Read Integer containing a character code.
Byte array or subarray.
Char array or subarray.
yes
ReadBoolean Boolean. yes
ReadByte Byte. yes
ReadBytes Byte array. yes
ReadChar Char. yes
ReadChars Char array.
Pages:
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202