score:1
both codes will return the same results. both have deferred execution (i.e. nothing will actually be executed until you start enumerating the result) and stream the results (i.e. not buffered). there shouldn't be a significant performance difference between the two versions
score:2
it's definitely functionally identical (although i've assumed that the lack of a new
keyword in your linq example was a typo).
there's a bit of null checking in select, but that's unlikely to significantly affect performance.
jon skeet has a good writeup on his blog here: http://msmvps.com/blogs/jon_skeet/archive/2010/12/23/reimplementing-linq-to-objects-part-3-quot-select-quot-and-a-rename.aspx
Source: stackoverflow.com
Related Query
- Are these enumerations code functionally the same?
- Are these two linq queries of the same performance? And How to implement .Any in linq query?
- L2E these two are the same thing?
- LINQ: check whether two list are the same
- The type of one of the expressions in the join clause is incorrect when the types are the same
- are these two linq expressions functionally equivalent?
- C#: how do you check lists are the same size & same elements?
- c# Check if all strings in list are the same
- Removing a single item from an enumerable source when the items are equal
- Why is this function faster and why are multiple enumerations of it faster than the first?
- Getting the number of elements that are the same at the same index
- Quick way to check 2 lists are the same c#
- Do these two statements mean the same thing?
- fastest way to compare if two ms sql tables are the same
- Linq GroupBy without merging groupings with the same key if they are separated by other key
- Is there a Linq operation to determine whether there are items in a collection who have the same values for a pair of properties?
- Are subqueries in LinqToSql guaranteed to be in the same order as their parent?
- LINQ sum some column when 2 other column values are the same
- What are the differences between these 2 LINQ statements?
- Linq Query to check if the records are all the same
- Do these 2 LINQ join queries achieve the same thing
- Are these the simplest ways to apply several different actions to a list of strings using LINQ?
- Output records which the values of the field are the same
- Why are stored procedures, functions, and views put into a .dbml file instead of the code file?
- LINQ Where(): are these two LINQ statements the same?
- Finding if all properties within a class are the same
- Why are these two anonymous types not the same?
- Find all answers that are the same
- scala -> use .net (linq) and java code base in the same program?
- How to write the same code using Lambda Expression
More Query from same tag
- User follow query that fetches the first top post for each user being follow
- Filter grouped products with Linq
- How Can I Match Orders to Products?
- Dapper Query ToList as IEnumerable<IDictionary<string,object>> result is null
- Linq crosstab and grouping
- LINQ Expression - Same value no more than twice
- Using LINQ to XML how can I group element on the basis of its value?
- How can i join two table in Linq and display the join to Data GridView?
- How do I make my method generic whereby I can pass in properties?
- Linq query related to some properties
- cannot cast expression of type 'system.xml.linq.xelement to type yyy
- LINQ find all child entities meet requirements
- Multiple Trees from a set of related objects in C#
- LinqToExcel Is it possible to read the formula as a string
- Linq query with negated condition in Any not returning the expected result
- Help with linq query with subqueries
- Create an asynchronous LinQ query
- How to get nearest date?
- What namespace do I need to import to get the RavenDB type 'IndexQuery'?
- How to iterate wIth one loop or no loop in elegant way using LINQ / Divide and Conquer method
- Optimize EntityFramework Query
- Linq lambda expression to get at least one duplicate along with non duplicates
- LINQ is able to filter on association, but returns 0 results when referenced directly
- How to return strongly type List F#
- How do I convert this SQL query to LINQ to SQL
- produce intersection and decomposition lists with two generic lists
- Entity framework navigation property FirstOrDefault()
- Performing a Sum() with LINQ query on database
- How do I query for when a field doesn't begin with a letter?
- how to generate next ID from database