In Extension method

Niladri.Biswas
Posted by Niladri.Biswas under C# category on | Points: 40 | Views : 755
public static bool In<T>(this T source, params T[] list)
{
return list.Contains(source);
}


Usage

var result= sourceCollection.Where(s => s.In("x", "y", "z"));

Comments or Responses

Login to post response