[lang-ref] ( filter_with_named_function ) ( csharp )

[Fact]
public void TestFilterWithNamedFunction()
{
    // items.Where(FuncName)
    List<int> items = new() { 1, 2, 3, 4, 5, 6 };
    List<int> expected = new() { 2, 4, 6 };

    bool IsEven(int x)
    {
        return x % 2 == 0;
    }

    List<int> actual = items.Where(IsEven).ToList();

    Assert.Equal(expected, actual);
}