
c# - How do I combine multiple linq queries into one results set ...
Jul 1, 2010 · Assuming the queries are of the same type, you could define the queries outside of the conditional statements. First, a helper method that creates an empty enumerable of the same type as the parameter: static IEnumerable<T> CreateEmptyEnumerable<T>(IEnumerable<T> templateQuery) { return Enumerable.Empty<T>(); } Then, the new code: var query1 = from t in table1 ... var query2 = from t in table2 ...
c# - Dynamically generate LINQ queries - Stack Overflow
Mar 1, 2012 · Is it possible to dynamically create new LINQ queries without recompilation of source code? Instead, the query parameters come from an XML structure that is stored and updated in the database.
c# - Debugging LINQ Queries - Stack Overflow
Jun 4, 2009 · We've been doing a lot of work with LINQ lately, mainly in a LINQ-to-Objects sense. Unfortunately, some of our queries can be a little complicated, especially when they start to involve multiple
c# - What is the "=>" sign in LINQ queries? - Stack Overflow
Apr 10, 2015 · When you use it in a linq expression, think of it as though the lambda function is being called on every element in the collection (which I believe is exactly what happens with linq to objects).
c# - LINQ: When to use Compiled Queries? - Stack Overflow
Sep 22, 2011 · The problem is that the compiled query is set in stone; it knows what SQL it will run against the database. The lambda expression is lazy loaded however, and cannot modify the compile query as it is being run during run time. The bad news is that it will return all of the records from the database, but it will query those records in memory to further refine them. If you want to compile the ...
c# - What is LINQ and what does it do? - Stack Overflow
LINQ stands for Language Integrated Query. Instead of writing YAQL (Yet Another Query Language), Microsoft language developers provided a way to express queries directly in their languages (such as C# and Visual Basic).
c# - LINQ query on a DataTable - Stack Overflow
Aug 14, 2008 · I'm trying to perform a LINQ query on a DataTable object and bizarrely I am finding that performing such queries on DataTables is not straightforward. For example: var results = from myRow in
c# - How can I conditionally apply a Linq operator? - Stack Overflow
Aug 14, 2008 · We're working on a Log Viewer. The use will have the option to filter by user, severity, etc. In the Sql days I'd add to the query string, but I want to do it with Linq. How can I conditionally add...
c# - How to optimize linq query for speed? - Stack Overflow
Dec 13, 2012 · I have a linq query which fetches all records from the customer table to an observable collection as below: customerList = new ObservableCollection<customer>(dbContext.customers); dgRecords1.
c# - When should I use a CompiledQuery? - Stack Overflow
Feb 8, 2011 · Compiled queries save you time, which would be spent generating expression trees. If the query is used often and you'll save the compiled query, you should definitely use it. I had many cases when the query parsing took more …