dahomey-technologies/Dahomey.Cbor

[Feature request] - make the bufferWriter visible in CborWriter struct

rsx2048 opened this issue · 0 comments

Since the CborWriter is a ref struct I wasn't able to use the value in a scenario where implementation of an interface was required. Was trying to wrap the writer in another struct for use by the interface defined members. language restrictions prevented this with a ref struct.
My solution was to make the CborWriter _bufferWriter field visible via a public property, then use that via new CborWriter instances in the interface members, e.g.
void IScalarWriter.Write(bool value) => new CborWriter(_writer).WriteBoolean(value);
where _writer is the IBufferWriter from the CborWriter instance passed to my converter.
Could you add the minor change to make the field visible in both reader & writer:
public IBufferWriter<byte> BufferWriter => _bufferWriter;

Also, any chance you could add a strongname signing certificate?

Thanks, Rob