Note
If elements of set are constants or simple expressions consider to use the InT(T, T) overload to eliminate the overhead of delegate invokes.
public static bool In<T>(
this T item,
params Func<T>[]? set
)
<ExtensionAttribute>
Public Shared Function In(Of T) (
item As T,
ParamArray set As Func(Of T)()
) As Boolean
public:
[ExtensionAttribute]
generic<typename T>
static bool In(
T item,
... array<Func<T>^>^ set
)
[<ExtensionAttribute>]
static member In :
item : 'T *
set : Func<'T>[] -> bool
This method works similarly to the in operator in SQL and Pascal.
This overload uses generic IEqualityComparerT implementations to compare the items for the best performance. The elements of set are evaluated only when they are actually compared so if a result is found the rest of the elements will not be evaluated.