BaudRate." /> BaudRate." /> BaudRate." />
Class Static
public static class BaudRateExtensions

Namespace: SharpMeter.Core.Protocol

Extension methods for BaudRate.

Methods

NameDescription
ToRate(BaudRate baudRate) static Converts a BaudRate to its integer baud rate value.

ToRate(BaudRate baudRate)

int BaudRateExtensions.ToRate(BaudRate baudRate)

Converts a BaudRate to its integer baud rate value.

View Source
/// <summary>
///     Extension methods for <see cref = "BaudRate"/>.
/// </summary>
public static class BaudRateExtensions
{
    /// <summary>Converts a <see cref = "BaudRate"/> to its integer baud rate value.</summary>
    public static int ToRate(this BaudRate baudRate) => baudRate switch
    {
        BaudRate.Baud300 => 300,
        BaudRate.Baud600 => 600,
        BaudRate.Baud1200 => 1200,
        BaudRate.Baud2400 => 2400,
        BaudRate.Baud4800 => 4800,
        BaudRate.Baud9600 => 9600,
        BaudRate.Baud14400 => 14400,
        BaudRate.Baud19200 => 19200,
        BaudRate.Baud28800 => 28800,
        BaudRate.Baud38400 => 38400,
        _ => throw new ArgumentOutOfRangeException(nameof(baudRate))};
}
Was this page helpful?