System.Func<bool> CheckAll
Runs through the Func<bool>.GetInvocationList() passing in the argument to each and returning an Or'd or And'd result.
Source
#region Func
#region Func<bool>
#region Or
public static bool CheckAll_Or(this Func<bool> func)
{
bool result = false;
foreach (Func<bool> f in func.GetInvocationList())
{
result |= f.Invoke();
}
return result;
}
public static bool CheckAll_Or<T1>(this Func<T1, bool> func, T1 arg1)
{
bool result = false;
foreach (Func<T1, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1);
}
return result;
}
public static bool CheckAll_Or<T1, T2>(this Func<T1, T2, bool> func, T1 arg1, T2 arg2)
{
bool result = false;
foreach (Func<T1, T2, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3>(this Func<T1, T2, T3, bool> func, T1 arg1, T2 arg2, T3 arg3)
{
bool result = false;
foreach (Func<T1, T2, T3, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4>(this Func<T1, T2, T3, T4, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5>(this Func<T1, T2, T3, T4, T5, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6>(this Func<T1, T2, T3, T4, T5, T6, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7>(this Func<T1, T2, T3, T4, T5, T6, T7, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
}
return result;
}
public static bool CheckAll_Or<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool> f in func.GetInvocationList())
{
result |= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16);
}
return result;
}
#endregion
#region And
public static bool CheckAll_And(this Func<bool> func)
{
bool result = false;
foreach (Func<bool> f in func.GetInvocationList())
{
result &= f.Invoke();
}
return result;
}
public static bool CheckAll_And<T1>(this Func<T1, bool> func, T1 arg1)
{
bool result = false;
foreach (Func<T1, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1);
}
return result;
}
public static bool CheckAll_And<T1, T2>(this Func<T1, T2, bool> func, T1 arg1, T2 arg2)
{
bool result = false;
foreach (Func<T1, T2, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3>(this Func<T1, T2, T3, bool> func, T1 arg1, T2 arg2, T3 arg3)
{
bool result = false;
foreach (Func<T1, T2, T3, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4>(this Func<T1, T2, T3, T4, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5>(this Func<T1, T2, T3, T4, T5, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6>(this Func<T1, T2, T3, T4, T5, T6, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7>(this Func<T1, T2, T3, T4, T5, T6, T7, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15);
}
return result;
}
public static bool CheckAll_And<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(this Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool> func, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16)
{
bool result = false;
foreach (Func<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, bool> f in func.GetInvocationList())
{
result &= f.Invoke(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16);
}
return result;
}
#endregion
#endregion
#endregion
Example
public static class SomeClass
{
...
public event Func<SomeType someArgument, bool> OnEvent;
...
}
public class OtherClass
{
...
bool any = SomeClass.OnEvent.CheckAll_Or<SomeType>(thisArgument);
bool all = SomeClass.OnEvent.CheckAll_And<SomeType>(thisArgument);
...
}