score:1
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))
{
Console.WriteLine(str);
}
Is the problem because your query sent to mysql database does not filter it?
Source: stackoverflow.com
Related Articles
- LINQ Source Code Available
- Linq Take not working
- creating Linq to sqlite dbml from DbLinq source code
- Linq code not working properly
- source code for LINQ 101 samples
- C# LINQ code not working for XML parse
- Linq Code with Distinct or GroupBy not working
- c# Linq or code to extract groups from a single list of source data
- Updating List using LINQ working when execute from Immediate window, not from code direct
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- Distinct not working with LINQ to Objects
- Linq code to select one item
- How are people unit testing code that uses Linq to SQL
- C# Linq All & Any working differently on blank array
- C# LINQ .Any not working on DocumentDb CreateDocumentQuery
- jqgrid with asp.net webmethod and json working with sorting, paging, searching and LINQ -- but needs dynamic operators
- LINQ with Skip and Take
- Using LINQ to take the top 100 and bottom 100?
- Take the first five elements and the last five elements from an array by one query using LINQ
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Using Linq Except not Working as I Thought
- Syntax to execute code block inside Linq query?
- Generic List .First not working LINQ
- Distinct not working with LINQ
- VB.NET linq group by with anonymous types not working as expected
- LINQ continue after Take
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Best open source LINQ provider
- Linq skip, take
- Compare two lists that contain a lot of objects (3th part) "those objects have different type"
- Linq strangeness
- Selecting the grouping Key in an Entity Framework query that groups by anonymous type ends up returning one key per grouped object
- Error When Querying For A Substring Using Dynamic Linq
- Date comparison format in stored procedure
- LINQ: Select First Item from Table A that has corresponding ID in linking table that connects to Table B
- Conditional Linq Expression Tree
- Violation of PRIMARY KEY constraint: Cannot insert duplicate key in object
- Dynamic Linq query issue
- Return @@RowCount in LINQ to SQL INSERT
- SQL Linq Reservation Availability
- Cannot Convert 'MyClass' to 'MyClass'
- getting specific x items from list using linq
- comparing two folders for non identical files with SymmetricDifference
- Fill Gridview using LINQ to DataSet query with alias
- SQL Server ADO.NET Query conversion to Linq in WCF service
- LINQ-Entities Group By With Range Variable Query
- How to define inheritance relationship in LINQ Entity Framework Core
- Linq nested Join from a group join if null
- linq group by contiguous blocks