score:8
No, there is no difference at all. The compiler internally transforms the second version to the first one.
The C# specification (§7.6.12) states:
The C# language does not specify the execution semantics of query expressions. Rather, query expressions are translated into invocations of methods that adhere to the query expression pattern (§7.16.3). Specifically, query expressions are translated into invocations of methods named
Where
,Select
,SelectMany
,Join
,GroupJoin
,OrderBy
,OrderByDescending
,ThenBy
,ThenByDescending
,GroupBy
, andCast
.These methods are expected to have particular signatures and result types, as described in §7.16.3. These methods can be instance methods of the object being queried or extension methods that are external to the object, and they implement the actual execution of the query.The translation from query expressions to method invocations is a syntactic mapping that occurs before any type binding or overload resolution has been performed. The translation is guaranteed to be syntactically correct, but it is not guaranteed to produce semantically correct C# code. Following translation of query expressions, the resulting method invocations are processed as regular method invocations, and this may in turn uncover errors, for example if the methods do not exist, if arguments have wrong types, or if the methods are generic and type inference fails.
score:3
Short question, short answer:
There is no difference. Both are the same, just written in different syntax.
See also the MSDN documentation for Query Syntax and Method Syntax.
score:4
There aren't differences. It will produce the same result in the same time. It's basically the same code with different syntax.
Source: stackoverflow.com
Related Query
- Performance Comparison of Two Linq Calls
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- LINQ Source Code Available
- How can I combine this code into one or two LINQ queries?
- Performance of DateTime comparison in LINQ
- creating Linq to sqlite dbml from DbLinq source code
- LINQ code to combine two database tables?
- Need a LINQ code example to link two tables that have no foreign key
- Performance comparison Sql query and Linq data query
- Linq query two arrays for difference based on field comparison
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- Performance Question between two Linq Queries in LinqPad and in Practice
- How to merge two lists while adding metadata indicating value source with LINQ statement?
- source code for LINQ 101 samples
- optimize the comparison in two lists with LINQ
- Wrong Comparison of two list using LINQ
- Linq performance when diffing two lists using inner Contains
- C# LINQ code for two list compare and replace
- Can I combine two Linq calls when they use different syntax?
- ASP.NET MVC LINQ Performance issue with two databases
- Is there any difference in performance between these two LINQ to SQL queries?
- Can my two linq lines of code be combined?
- How to improve the performance of a LINQ query that compares two lists?
- c# Linq or code to extract groups from a single list of source data
- Saved projection expression for re-use in different linq expressions with two source objects
- LINQ Comparison Between Two Child Property List Types?
- Using Linq for comparison of two Datatables
- Convert string[] to int[] in one line of code using LINQ
- Create a list from two object lists with linq
- Linq code to select one item
More Query from same tag
- Unable to cast object of type grouping to datarow after i grouped datatable with linq
- Odata Linq Expand, How I can select the columns I need
- Inner join query in EF6
- How to sort my IQueryable hierarchically in a flat list?
- Relax C# LINQ String Comparison (Trim, Case Insensitive, ??)
- Unable to cast object of type 'WhereSelectListIterator` in LINQ
- Linq does not contain the definition for 'Where'
- Permutate items on shelf positions using C#
- how to extract xml node using LinqtoXml
- Self Join in LINQ is failing when applying to an edmx entity data model
- Select 50 to 100 rows from datatable
- LINQ Query with dynamic where clause based on search criteria that is NOT part of the returned object
- DataStax C# Driver for Apache Cassandra for Materialized View
- Extract items of IEnumerable<T> whose Key-Value is equal to one of the KeyValues in IEnumerable<U>
- Inserting XML to XMLDocument
- Convert VB Linq with Group by and Select to C#
- Unable to create instance of MyEntities
- Linq for sum of distinct addresses
- Extending IQueryable with IsInDateTimeRange
- Linq Get Max from List of Records
- ObjectQuery to return object where a child object contains a set value
- Use LINQ to populate a single list from two other lists
- Retrieve comma-separated values from IQueryable and add to list
- Entity Framework Core: Request for Composite Table (Composite Key)
- Compare 2 objects of the same type on the id field so I know to update or save the object
- Why am I not able to insert a value to a StringBuilder inside a LINQ Select() query
- Linq Query Select from table1 where id in (select from table2 inner join table3 on table2 = table3 where table3 = id )
- Get dates that contain all selected products
- How do write LINQ query to do recursion?
- How do I get an Object from the Primary Key