Mongo.Context.MongoMetadata.GetRawValueType C# (CSharp) Method

GetRawValueType() private static method

private static GetRawValueType ( BsonValue elementValue, bool isKey = false ) : Type
elementValue BsonValue
isKey bool
return System.Type
        private static Type GetRawValueType(BsonValue elementValue, bool isKey = false)
        {
            Type elementType;
            switch (elementValue.BsonType)
            {
                case BsonType.DateTime:
                    elementType = typeof(DateTime);
                    break;
                default:
                    elementType = BsonTypeMapper.MapToDotNetValue(elementValue).GetType();
                    break;
            }
            if (!isKey && elementType.IsValueType)
            {
                elementType = typeof(Nullable<>).MakeGenericType(elementType);
            }
            return elementType;
        }