void ICborConverter <CborArray?> .Write(ref CborWriter writer, CborArray?value, LengthMode lengthMode) { if (value == null) { writer.WriteNull(); return; } ArrayWriterContext arrayWriterContext = new ArrayWriterContext { array = value, lengthMode = lengthMode != LengthMode.Default ? lengthMode : _options.ArrayLengthMode }; writer.WriteArray(this, ref arrayWriterContext); }
bool ICborArrayWriter <ArrayWriterContext> .WriteArrayItem(ref CborWriter writer, ref ArrayWriterContext context) { if (context.array.Count > 0) { Write(ref writer, context.array[context.index++]); return(context.index < context.array.Count); } return(false); }
int ICborArrayWriter <ArrayWriterContext> .GetArraySize(ref ArrayWriterContext context) { return(context.lengthMode == LengthMode.IndefiniteLength ? -1 : context.array.Count); }