score:3
no. basically query expressions exist in order to keep this stuff away from you. there's no particularly simple way of mimicking transparent identifiers.
i find that when you hit transparent identifiers, it's almost always cleaner to use query expression syntax. it's definitely worth knowing both, as very simple queries are cleaner using method syntax, but the more complicated the query, the more likely it is to be easier to read using query expressions.
that's assuming it can all be represented with method expressions, of course. don't forget you can break up queries into separate statements without changing the meaning, so if you do need to call methods which don't have query expression equivalents, i sometimes find it best to separate it out like this:
var foo = from x in y
join a in b on x.z equals a.z
select new { a, x };
var bar = foo.skip(5)
.take(10)
.tolist();
i find that cleaner than just using brackets to mush the two syntax forms together.
Source: stackoverflow.com
Related Query
- LINQ, can I write cleaner joins with method syntax?
- How to convert Linq expression with multiple joins into method syntax OR retrieve select index?
- LinQ method syntax multiple tables with .where() and without joins
- GroupBy with linq method syntax (not query syntax)
- JOIN and LEFT JOIN equivalent in LINQ with Method Syntax
- LINQ Method Syntax with INNER and OUTER Join
- How can I write the following code more elegantly using LINQ query syntax?
- Problems trying to use GroupBy with multiple properties using the LINQ Method Syntax
- Convert linq query expression with multiple froms into extension method syntax
- LINQ syntax for CONTAINS method with an inclusive "filter"
- Calling method with linq syntax based on condition
- Conditionally Insert Where Clause in LINQ Method Syntax with Select Many
- Can a LINQ extension method create a new KeyValuePair with a new() .Value when a Where clause isn't satisfied
- Can this LINQ Expression be converted from method syntax to query syntax?
- multiple linq joins with anonymous types using lambda syntax
- LINQ method syntax to group by a column, pick one element from each group with total count per group
- Is there any way to encapsulate a simple LINQ query in an extension method that can be used with LINQ to Entities query?
- LINQ Join on multiple columns with different record using extension method syntax
- How To Introduce a Void Method to a LINQ Query with Query Syntax
- How do I write Joins between multiple tables with Linq and ASP.Net Forms
- method syntax for linq query with multiple from clauses
- LINQ syntax for SQL query with multiple inner joins and aliases
- How can i write Linq2Entities Query with inner joins
- Write LINQ query without select or group clause using extension method syntax
- Entity Framework - convert LINQ method chain with SelectMany to query syntax
- how to write a Linq query with a EF code first Many to Many relationship
- Linq query syntax to method syntax when using multiple joins to introduce dynamic restrictions
- Column getting lost in LINQ with Method Syntax after group by
- How can I convert Sql query to Linq and its equivalent with Join() method in Entity Framework Core
- Combining LINQ queries with method syntax
More Query from same tag
- LINQ to DataSet Group By Multiple Columns - Method Syntax
- Two generic types in a extension method
- How does this Moq Test work mainly regarding linq syntax?
- Get list of child records
- data type casting in Linq to Sql
- Understanding Deferred Execution: Is a Linq Query Re-executed Everytime its collection of anonymous objects is referred to?
- fastest way to check to see if a certain index in a linq statement is null
- There is no ViewData item of type 'IEnumerable' that has the key
- LINQ query checks for null
- Better method to get users belonging to no role?
- How to get all id in table1 and save to table2 using c# mvc?
- Exception raised when using a Linq query with Entity Framework
- How to use AggregateToCollection() to store the results of an IMongoQueryable in a collection
- using C# linq to write XML
- Find most related post in many to many relationship
- How to Filter data based on two property in linq
- Linq to XML grouping with predicates
- Sharing queries between Rx and LINQ (or generically, streams and lists)
- How can I use comparison operators with boxed numerics of unknown types in c#?
- JsonSerializer.Deserialize Many Time Use
- Create lambda expression for OrderBy based on string
- Crystal report not showing any data
- Linq to Entities delete
- Move record from a Table to another using foreach in C#
- Using Linq to filter out certain Keys from a Dictionary and return a new dictionary2
- What is the best way to sort using a GridView and LINQ?
- Traversing DataRelations in ASP.NET Gridview with ADO.NET and .NET 4
- Better way to sort array in descending order
- How to write SQL procedure to insert multiple items at a time from the list?
- LINQ Query - Explanation needed of why these examples are different