Exemple #1
0
 /// <summary>
 /// Indicates whether the current <see cref="Optional{T}"/> object is equal to a specified value.
 /// </summary>
 /// <param name="other">A value.</param>
 /// <returns><c>true</c> if the other parameter is equal to the current <see cref="Optional{T}"/> object; otherwise, <c>false</c>.</returns>
 public bool Equals(T other) => OptionalEqualityComparer <T> .EqualsCore(this, other, EqualityComparer <T> .Default);
Exemple #2
0
 /// <summary>
 /// Determines whether the specified optional values are equal.
 /// </summary>
 /// <typeparam name="T">The underlying type of the <see cref="Optional{T}"/> generic type.</typeparam>
 /// <param name="x">The first optional value to compare.</param>
 /// <param name="y">The second optional value to compare.</param>
 /// <param name="valueComparer">The value equality comparer.</param>
 /// <returns><c>true</c> if the specified objects are equal; otherwise, <c>false</c>.</returns>
 public static bool Equals <T>(Optional <T> x, Optional <T> y, IEqualityComparer <T> valueComparer) =>
 OptionalEqualityComparer <T> .EqualsCore(x, y, valueComparer ?? EqualityComparer <T> .Default);
Exemple #3
0
 /// <summary>
 /// Indicates whether the current <see cref="Optional{T}"/> object is equal to a specified object.
 /// </summary>
 /// <param name="obj">An object.</param>
 /// <returns><c>true</c> if the other parameter is equal to the current <see cref="Optional{T}"/> object; otherwise, <c>false</c>.</returns>
 public override bool Equals(object obj) => OptionalEqualityComparer <T> .EqualsCore(this, obj, EqualityComparer <T> .Default);
Exemple #4
0
 /// <summary>
 /// Returns a hash code for the specified optional value.
 /// </summary>
 /// <typeparam name="T">The underlying type of the <see cref="Optional{T}"/> generic type.</typeparam>
 /// <param name="optional">The optional value.</param>
 /// <param name="valueComparer">The value equality comparer.</param>
 /// <returns>A hash code for the specified optional value.</returns>
 public static int GetHashCode <T>(Optional <T> optional, IEqualityComparer <T> valueComparer) =>
 OptionalEqualityComparer <T> .GetHashCodeCore(optional, valueComparer ?? EqualityComparer <T> .Default);