Beispiel #1
0
 /// <summary>
 /// Convert Nullable<Enum> from RedisValue
 /// </summary>
 /// <param name="value">Nullable<Enum> value to convert</param>
 /// <param name="type">Nullable<Enum> type to convert</param>
 /// <param name="provider">provider controls how enum value is converted</param>
 /// <returns>Nullable<Enum> value contained in RedisValue</returns>
 public static object ConvertFrom(RedisValue value, Type type, IFormatProvider provider)
 {
     return(value.IsNull ? null : EnumConverter.ConvertFrom(value, Nullable.GetUnderlyingType(type), provider));
 }
Beispiel #2
0
 /// <summary>
 /// Convert Nullable<Enum> to RedisValue
 /// </summary>
 /// <param name="value">Nullable<Enum> value to convert</param>
 /// <param name="type">Nullable<Enum> type to convert</param>
 /// <param name="provider">provider controls how enum value is converted</param>
 /// <returns>RedisValue represents Nullable<Enum> value</returns>
 public static RedisValue ConvertTo(object value, Type type, IFormatProvider provider)
 {
     return(value == null ? RedisValue.Null : EnumConverter.ConvertTo(value, Nullable.GetUnderlyingType(type), provider));
 }