IsIn

    public static bool IsIn<T>(this T keyObject, IEnumerable<T> collection)
    {
        return collection.Contains(keyObject);
    }
Example:
var inclusionList = new List<string> { "inclusion1", "inclusion2" };
var query = myEntities.MyEntity
                     .Select(e => e.Name)
                     .Where(e => e.IsIn(inclusionList));

Description

Determines if an instance is contained in a sequence. Is the equivalent of Contains, but allows a more fluent reading "if item is in list", specially useful in LINQ extension methods like Where

Details

Double click on the code to select all.

 

;