LINQ is great for selecting data. But how can you limit the number of items returned from a LINQ expression? In MySQL, we use the
LIMIT n clause with a number indicating that MySQL should return the first
In LINQ, this functionality is available via the
Take keyword. For example, this code:
.OrderBy(e => e.Name)
… would return the the employees (by name) who are paid a salary of $100,000 or more.