/// <summary>
        /// Reads a BsonArray from a BsonReader.
        /// </summary>
        /// <param name="bsonReader">The reader.</param>
        /// <returns>A BsonArray.</returns>
        public static new BsonArray ReadFrom(BsonReader bsonReader)
        {
            var array = new BsonArray();

            bsonReader.ReadStartArray();
            while (bsonReader.ReadBsonType() != BsonType.EndOfDocument)
            {
                var value = BsonValue.ReadFrom(bsonReader);
                array.Add(value);
            }
            bsonReader.ReadEndArray();
            return(array);
        }
        // internal static methods
        internal static bool ReadFrom(BsonReader bsonReader, out BsonElement element)
        {
            BsonType bsonType;

            if ((bsonType = bsonReader.ReadBsonType()) != BsonType.EndOfDocument)
            {
                var name  = bsonReader.ReadName();
                var value = BsonValue.ReadFrom(bsonReader);
                element = new BsonElement(name, value);
                return(true);
            }
            else
            {
                element = null;
                return(false);
            }
        }