Doubt in a lambda expression returning "true"

3

When I do this:

List<Tipo1> tipo = await context.MeuMetodo.Find(x => true).ToListAsync();

What am I saying here: (x => true) ?

    
asked by anonymous 27.06.2018 / 15:12

1 answer

3

In this context it should catch everything, so the result of the expression in every element that Find() filters is true, so it does not filter anything, it passes everything. See if you can only remove Find() .

I just do not say because it can depend on the LINQ provider and without it something can go wrong, but in general it should not have any use and can only do:

List<Tipo1> tipo = await context.MeuMetodo.ToListAsync();

Or even this.

Unless you have something I do not know.

    
27.06.2018 / 15:15