예제 #1
0
 /// <summary>
 /// Creates a sentinel value to indicate an increment by the given value.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If the current value is an integer or a double, both the current and the given value will be
 /// interpreted as doubles and all arithmetic will follow IEEE 754 semantics.Otherwise, the
 /// transformation will set the field to the given value.
 /// </para>
 /// </remarks>
 /// <param name="amount">The amount to increment the field by.</param>
 /// <returns>A sentinel value representing a field increment.</returns>
 public static object Increment(double amount) =>
 SentinelValue.ForIncrement(new Value {
     DoubleValue = amount
 });
예제 #2
0
 /// <summary>
 /// Creates a sentinel value to indicate an increment by the given value.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If the current field value is an integer, possible integer overflows are resolved to
 /// <see cref="long.MaxValue"/> or <see cref="long.MinValue"/>. If the current field value
 /// is a double, both values will be interpreted as doubles and the arithmetic will follow IEEE 754 semantics.
 /// </para>
 /// <para>
 /// If the current field is not an integer or double, or if the field does not yet exist, the
 /// transformation will set the field to the given value.
 /// </para>
 /// </remarks>
 /// <param name="amount">The amount to increment the field by.</param>
 /// <returns>A sentinel value representing a field increment.</returns>
 public static object Increment(long amount) =>
 SentinelValue.ForIncrement(new Value {
     IntegerValue = amount
 });