Skip to content

Commit 45f3add

Browse files
authored
Add WriteByte to SerialPort (#86)
***NO_CI***
1 parent 8e5078c commit 45f3add

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

System.IO.Ports/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
////////////////////////////////////////////////////////////////
1414
// update this whenever the native assembly signature changes //
15-
[assembly: AssemblyNativeVersion("100.1.4.0")]
15+
[assembly: AssemblyNativeVersion("100.1.5.0")]
1616
////////////////////////////////////////////////////////////////
1717

1818
// Setting ComVisible to false makes the types in this assembly not visible

System.IO.Ports/SerialPort.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,20 @@ public int ReadByte()
726726
public extern void Write(byte[] buffer, int offset, int count);
727727
#pragma warning restore S4200 // Native methods should be wrapped
728728

729+
/// <summary>
730+
/// Writes a byte to the serial port.
731+
/// </summary>
732+
/// <param name="value">The byte to write to the port.</param>
733+
/// <exception cref="InvalidOperationException">The specified port is not open.</exception>
734+
/// <exception cref="TimeoutException">The operation did not complete before the time-out period ended.</exception>
735+
public void WriteByte(byte value)
736+
{
737+
Write(
738+
new byte[] { value },
739+
0,
740+
1);
741+
}
742+
729743
/// <summary>
730744
/// Writes the specified string to the serial port.
731745
/// </summary>

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"assemblyVersion": {
55
"precision": "revision"
66
},

0 commit comments

Comments
 (0)