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)

Why You Need to Know LINQ to XML

In .NET 3.5, the primary device for general processing of XML is LINQ To XML. This provides a lightweight, LINQ-friendly DOM along with a set of query operators. In SiIlverlight, this is your only choice – XmlDocument and related classes are not supported. Even without its LINQ support, the LINQ To XML DOM is valuable [...]

  • Share/Bookmark

Tags: , , , ,

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)

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 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)

Solving Issues With LINQ Foreach Variables

Can you guess what the output of the following program is? using System; using System.Collections.Generic; namespace Lambda { class Program { static void Main(string[] args) { var strings = new[] {“a”, “b”, “c”}; var actions = CreateActions(strings); actions.ForEach(f => f()); } private static List CreateActions(IEnumerable strings) { var actions = new List(); foreach (var s [...]

  • Share/Bookmark

Tags: ,

Read Users' Comments (0)

How to Execute Arbitrary SQL using LINQ to SQL [Video]

This video, courtesy of Microsoft’s ASP.NET video series, provides an example of using LINQ to SQL to execute arbitrary SQL against a database.

  • Share/Bookmark

Tags: ,

Read Users' Comments (0)

How to Update a Table with LINQ to SQL and Stored Procedures [Video]

This video, courtesy of Microsoft’s ASP.NET video series, provides an example of using LINQ to SQL and stored procedures to update a table.

  • Share/Bookmark

Tags: , ,

Read Users' Comments (0)

 Page 1 of 2  1  2 »