LINQ ToLookup vs ToDictionary

Some people are not sure of the difference between ToLookup vs ToDictionary LINQ methods. To break it down real simple: One is a look up (ToLookup) One is a dictionary (ToDictionary) Duh – that’s what you’re probably thinking. The real difference is understanding what each of these data structures do. Lookups A lookup is a [...]

  • Share/Bookmark

Tags: , , ,

Read Users' Comments (0)

Implementing LINQ on the .NET Micro Framework

The .NET Micro Framework, a variant of .NET radically scaled down for embedded systems, does not include the System.Linq namespace and does not provide any LINQ functionality. Because its implementation is based on generics, LINQ requires version 2.0 of the CLR. The Micro Framework on the other hand is restricted to the CLI, a standardized [...]

  • Share/Bookmark

Tags: , , , ,

Read Users' Comments (0)

How to Use .Except with EqualityComparer

Today we’re going to cover an advanced scenario where we need to compare lists of a class we created. We’ll start with an implementation of EqualityComparer<T> which consists of overriding two methods: Equals and GetHashCode. What was a little tricky about this implementation is this subtle, but critical, comment in the code sample on MSDN [...]

  • Share/Bookmark

Tags: , , , , , ,

Read Users' Comments (1)

Guidelines and Best Practices in Optimizing LINQ

Language Integrated Query (LINQ) is a query execution pipeline for use in the managed environment of .NET Framework. In essence, LINQ is Microsoft’s object relational mapper between your business objects and the underlying data sources and provides a simplified framework for accessing relational data in an object-oriented fashion. Although LINQ is great in the sense [...]

  • Share/Bookmark

Tags: , ,

Read Users' Comments (1)

How To Limit String Field Lengths for LINQ to SQL

We recently had an issue where a string value in our LINQ object was changed and became longer than the database field it represented. Whenever we tried to apply the changes to the database we would get an error. Now, I know that the correct solution is to implement the proper checks earlier on in [...]

  • Share/Bookmark

Read Users' Comments (0)

Generic Delegates and Lambda Expressions

Generic delegates and lambda expressions underpin LINQ. If you’ve been struggling to get your arms around these new concepts, this post should help demystify matters for you. Of course, there are a a host of other new .NET language features that enable LINQ as well. These include extension methods, type inference, anonymous types, object initializers, [...]

  • Share/Bookmark

Tags: , , , , ,

Read Users' Comments (0)

Call for LINQ Content

As part of our goal to make Linq Exchange a more social website, I’m inviting you, the friendly reader, to submit your LINQ or Lambda Expression article. Your article will appear on the Linq Exchange website within one week of submission (pending review and approval). You may include one link back to your blog or [...]

  • Share/Bookmark

Tags:

Read Users' Comments (0)

Practical Understanding of Lambda Expressions in LINQ

Lambda expressions are a powerful tool to writing quick, concise code. They can be used in numerous situations, most notably in conjuction with LINQ statements. A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types. All lambda expressions use the lambda [...]

  • Share/Bookmark

Tags: , , , ,

Read Users' Comments (0)

How to Use IDisposable with LINQ

Objects that implement IDisposable are everywhere. The interface even gets its own language features (C#, VB, F#). However, LINQ throws a few wrenches into things: LINQ’s query syntax depends on expressions; using blocks are statements. When querying a sequence of IDisposable objects, there’s no easy way to ensure disposal after each element has been consumed. [...]

  • Share/Bookmark

Tags: , , , ,

Read Users' Comments (0)

How to Share Parameters Between Lambda Expressions

When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it’s not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not [...]

  • Share/Bookmark

Tags: , ,

Read Users' Comments (1)

 Page 1 of 9  1  2  3  4  5 » ...  Last »