MongoDB.Bson.RawBsonArray.CopyTo C# (CSharp) Method

CopyTo() public method

Copies elements from this array to another array.
public CopyTo ( BsonValue array, int arrayIndex ) : void
array BsonValue The other array.
arrayIndex int The zero based index of the other array at which to start copying.
return void
        public override void CopyTo(BsonValue[] array, int arrayIndex)
        {
            ThrowIfDisposed();
            using (var bsonReader = new BsonBinaryReader(new BsonBuffer(CloneSlice(), false), true, _readerSettings))
            {
                bsonReader.ReadStartDocument();
                while (bsonReader.ReadBsonType() != BsonType.EndOfDocument)
                {
                    bsonReader.SkipName();
                    array[arrayIndex++] = DeserializeBsonValue(bsonReader);
                }
                bsonReader.ReadEndDocument();
            }
        }

Same methods

RawBsonArray::CopyTo ( object array, int arrayIndex ) : void