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
Cast.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.
There aren't differences. It will produce the same result in the same time. It's basically the same code with different syntax.
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.
- Performance Comparison of Two Linq Calls
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- LINQ Source Code Available
- Performance of DateTime comparison in LINQ
- creating Linq to sqlite dbml from DbLinq source code
- Performance comparison Sql query and Linq data query
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- source code for LINQ 101 samples
- c# Linq or code to extract groups from a single list of source data
- Convert string to int in one line of code using LINQ
- Linq code to select one item
- LINQ performance FAQ
- How are people unit testing code that uses Linq to SQL
- Performance of LINQ Any vs FirstOrDefault != null
- foreach + break vs linq FirstOrDefault performance difference
- For vs. Linq - Performance vs. Future
- What is the Efficiency and Performance of LINQ and Lambda Expression in .Net?
- LINQ performance Count vs Where and Count
- Aggregate vs Sum Performance in LINQ
- Issues Doing a String Comparison in LINQ
- Is multiple .Where() statements in LINQ a performance issue?
- String comparison performance in C#
- Linq ToList/ToArray/ToDictionary performance
- SQL vs LINQ performance
- LINQ Performance for Large Collections
- LINQ Lambda vs Query Syntax Performance
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Performance concern when using LINQ "everywhere"?
- Performance for using 2 where clauses in LINQ
- Why I lose performance if I use LINQ on MongoDB?
- When using GroupBy in linq, how can I get a list of group names?
- User Details Don't Show Up Using Pagination
- Is Linq to NHibernate in the 2.1 Alpha release?
- filtering age of members using linq
- LINQ to SQL Query for Many-to-Many relationship
- LinqToExcel syntax
- How to collect properties of a list to another list in C#?
- How to convert SQL, many to many relationship, to Linq statement
- xml Class to substitute ini files
- Trimming characters with SqlFunctions in C#
- Using Expression Class With LINQ Queries
- How does Entity framework perform Transactions inside asp.net mvc
- Compare a Datatable and string array in c#
- Find if Object Exists in Dbset
- Orderby descending does not work with DateTime
- LINQ TO XML, How to replace values with new values c#
- How do I iterate over a DataTable and get groups of rows based on a column value?
- Can you convert this Linq statement into Lambda without using join statements?
- To add a property value to an existing list of a class
- Get a string of values and their count using LINQ