Example #1
0
 /// <summary>
 /// Sets, in an atomic operation, the values of the state associated
 /// with the key <paramref name="name"/> if the current value is less
 /// the given state or if the key is not found.
 /// </summary>
 /// <param name="states">
 /// A <see cref="IAppState"/> to extend.
 /// </param>
 /// <param name="name">
 /// The name of the state to set.
 /// </param>
 /// <param name="state">
 /// The value of the state to set.
 /// </param>
 /// <param name="comparand">
 /// The value that is compared to the current state.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// The local database does not support the type <see cref="T"/>
 /// </exception>
 public static bool SetIfEqualsTo <T>(this IAppState states, string name,
                                      T state, T comparand)
 {
     return(states.SetIf(ComparisonOperator.Equals, name, state, comparand));
 }
Example #2
0
 /// <summary>
 /// Sets, in an atomic operation, the values of the state associated
 /// with the key <paramref name="name"/> if the current value is less
 /// the given state or if the key is not found.
 /// </summary>
 /// <param name="states">
 /// A <see cref="IAppState"/> to extend.
 /// </param>
 /// <param name="name">
 /// The name of the state to set.
 /// </param>
 /// <param name="state">
 /// The value of the state to set.
 /// </param>
 /// <param name="comparand">
 /// The value that is compared to the current state.
 /// </param>
 /// <exception cref="NotSupportedException">
 /// The local database does not support the type <see cref="T"/>
 /// </exception>
 public static bool SetIfLessThan <T>(this IAppState states, string name,
                                      T state, T comparand)
 {
     return(states.SetIf(ComparisonOperator.LessThan, name, state, comparand));
 }