Exemple #1
0
        /// <summary>
        /// Deserializes a GeoJson object.
        /// </summary>
        /// <param name="bsonReader">The BsonReader.</param>
        /// <param name="data">The data.</param>
        /// <returns>A GeoJson object.</returns>
        protected object DeserializeGeoJsonObject(BsonReader bsonReader, ObjectData data)
        {
            if (bsonReader.GetCurrentBsonType() == BsonType.Null)
            {
                bsonReader.ReadNull();
                return(null);
            }
            else
            {
                bsonReader.ReadStartDocument();
                while (bsonReader.ReadBsonType() != BsonType.EndOfDocument)
                {
                    var name = bsonReader.ReadName();
                    DeserializeField(bsonReader, name, data);
                }
                bsonReader.ReadEndDocument();

                return(data.CreateInstance());
            }
        }