Skip to content

Instantly share code, notes, and snippets.

@HaanstootZA
Last active January 15, 2021 07:26
Show Gist options
  • Select an option

  • Save HaanstootZA/b07468f95ab9a369ffc2c933c15b1498 to your computer and use it in GitHub Desktop.

Select an option

Save HaanstootZA/b07468f95ab9a369ffc2c933c15b1498 to your computer and use it in GitHub Desktop.
namespace example
{
public static class EnumerableHelper
{
public static bool In<T>(this T testValue, params T[] testParameters)
{
return testValue.In((left, right) => object.Equals(left, right), testParameters);
}
public static bool In<T>(this T testValue, Func<T, T, bool> testFunction, params T[] testParameters)
{
foreach (T testParameter in testParameters)
{
if (testFunction.Invoke(testValue, testParameter))
{
return true;
}
}
return false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment