public static string ToHexaString(this ReadOnlySpan <byte> bytes, HexaOptions options) { if (bytes.Length == 0) { return(string.Empty); } return(options switch { HexaOptions.LowerCase => ToHexaLowerCase(bytes), HexaOptions.UpperCase => ToHexaUpperCase(bytes), _ => throw new ArgumentOutOfRangeException(nameof(options)), });
public static string ToHexa(this byte[] bytes, HexaOptions options) { if (bytes == null) { throw new ArgumentNullException(nameof(bytes)); } if (bytes.Length == 0) { return(string.Empty); } return(options switch { HexaOptions.LowerCase => ToHexaLowerCase(bytes), HexaOptions.UpperCase => ToHexaUpperCase(bytes), _ => throw new ArgumentOutOfRangeException(nameof(options)), });
public static string ToHexa(this byte[] bytes, HexaOptions options) { if (bytes == null) { throw new ArgumentNullException(nameof(bytes)); } if (bytes.Length == 0) { return(string.Empty); } switch (options) { case HexaOptions.LowerCase: return(ToHexaLowerCase(bytes)); case HexaOptions.UpperCase: return(ToHexaUpperCase(bytes)); default: throw new ArgumentOutOfRangeException(nameof(options)); } }
public static string ToHexaString(this byte[] bytes, HexaOptions options) { return(ToHexaString(bytes.AsSpan(), options)); }