public override void WriteEndArray()
{
if (Disposed) { throw new ObjectDisposedException("BsonBinaryWriter"); }
if (State != BsonWriterState.Value)
{
ThrowInvalidState("WriteEndArray", BsonWriterState.Value);
}
if (_context.ContextType != ContextType.Array)
{
ThrowInvalidContextType("WriteEndArray", _context.ContextType, ContextType.Array);
}
base.WriteEndArray();
_buffer.WriteByte(0);
BackpatchSize(); // size of document
_context = _context.ParentContext;
State = GetNextState();
}