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)); } }
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)); } }