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

Contains() public method

Tests whether the array contains a value.
public Contains ( BsonValue value ) : bool
value BsonValue The value to test for.
return bool
        public override bool Contains(BsonValue value)
        {
            ThrowIfDisposed();
            using (var bsonReader = new BsonBinaryReader(new BsonBuffer(CloneSlice(), false), true, _readerSettings))
            {
                bsonReader.ReadStartDocument();
                while (bsonReader.ReadBsonType() != BsonType.EndOfDocument)
                {
                    bsonReader.SkipName();
                    if (DeserializeBsonValue(bsonReader).Equals(value))
                    {
                        return true;
                    }
                }
                bsonReader.ReadEndDocument();

                return false;
            }
        }