Пример #1
0
 public static T zTryAsEnum <T>(this BsonValue bsonValue, T defaultValue, bool ignoreCase = false)
 {
     if (bsonValue == null || bsonValue is BsonNull)
     {
         return(defaultValue);
     }
     else
     {
         return(bsonValue.zAsEnum <T>(ignoreCase));
     }
 }
Пример #2
0
 public static T?zAsNullableEnum <T>(this BsonValue bsonValue, bool ignoreCase = false) where T : struct
 {
     if (bsonValue == null || bsonValue is BsonNull)
     {
         return(null);
     }
     else
     {
         return(bsonValue.zAsEnum <T>(ignoreCase));
     }
 }