/// <summary> /// Creates a <see cref="Match{T}"/> instance that matches successfully when a value matches all 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 all 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> All <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> .All(matches)); }
private static Match <T> NewInstance <T>(params Match <T>[] matches) { return(Match.All(matches)); }