I\'d like to read and write bytes and structured value types, asynchronously, without having to worry about decoders and byte-shifting: is there something out there that wou
I've created versions of those classes that are async: https://github.com/ronnieoverby/AsyncBinaryReaderWriter
Example usage:
async Task Main()
{
using var ms = new MemoryStream();
using var writer = new AsyncBinaryWriter(ms);
await writer.WriteAsync("today is: ");
await writer.WriteAsync(DateTime.Today.Ticks);
await writer.FlushAsync();
ms.Position = 0;
using var reader = new AsyncBinaryReader(ms);
var preamble = await reader.ReadStringAsync();
var payload = new DateTime(await reader.ReadInt64Async());
Console.WriteLine(preamble + payload);
}
All of the same read/write methods present on the BCL binary reader/writer classes are present.