Skip to content

Instantly share code, notes, and snippets.

@hepe00
hepe00 / SerialPortExtensions.cs
Created June 9, 2021 01:31 — forked from adamkewley/SerialPortExtensions.cs
Extension methods to make System.IO.Ports.SerialPort easier to use with .NET 4.5 async workflows (Does not support timeouts)
using System.IO.Ports;
namespace AsyncExtensions {
public static class SerialPortExtensions
{
/// <summary>
/// Read a line from the SerialPort asynchronously
/// </summary>
/// <param name="serialPort">The port to read data from</param>
/// <returns>A line read from the input</returns>