After you materialize the results with .ToList() its absolutely same situation. If you want filter only the first 10 results from database WITH THE QUERY. You need to include the .Take(10) before materializing the query.

Below code will write 5 lines to console.

// This simulates the results from your query after you materialize it with Tolist()
var results = new List<string>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
foreach(var str in results.Take(5))

Is the problem because your query sent to mysql database does not filter it?

Related Articles