/// <summary> /// Creates a <see cref="Match{T}"/> instance that matches successfully when a value matches any of the specified <paramref name="matches"/>. /// </summary> /// <param name="matches"> /// The matches a value is matched with. /// </param> /// <typeparam name="T"> /// The type of the value to match. /// </typeparam> /// <returns> /// A new <see cref="Match{T}"/> instance that determines whether a value matches any of the specified <paramref name="matches"/>. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="matches"/> is <c>null</c>. /// </exception> /// <exception cref="ArgumentException"> /// <paramref name="matches"/> contain at least one match that is <c>null</c>. /// </exception> public static Match <T> Any <T>(params Match <T>[] matches) { if (ReferenceEquals(matches, null)) { throw new ArgumentNullException(nameof(matches)); } if (matches.Any(match => ReferenceEquals(match, null))) { throw new ArgumentException("At least one match is a null reference.", nameof(matches)); } return(Match <T> .Any(matches)); }
private static Match <T> NewInstance <T>(params Match <T>[] matches) { return(Match.Any(matches)); }