JD2022-TU1/main/tools/framework/JD.Collections/IsInExtension.cs

20 lines
No EOL
475 B
C#

namespace JD.Collections
{
public static class IsInExtension
{
/// <summary>
/// True if the current value is in the set.
/// </summary>
public static bool IsIn<T>(this T value, params T[] set)
{
foreach (var otherValue in set)
{
if (Equals(value, otherValue))
{
return true;
}
}
return false;
}
}
}