Oct 252010
 

Was another great weekend with the development community, got to meet allot of great people and Maddux had a great time.

Got to present Linq 4.0 and Silverlight LOB this time around and had a great turn out.  Infragistics helped with providing 3 NetAdvantage Licenses for give aways – thanks Infragistics and the winners.

I am now moving my discussions to Line of Business presentations, so that was the last time the Linq 4.0 presentation will be presented.

Again, thanks everyone for coming and thanks to the coordinators.

Feb 272009
 

LINQ is a new type-safe query structure available in C# 3.0 and .NET 3.5 Microsoft framework.  With LINQ you can query against any collection that implements IEnumerable<> or remote data sources.  With this, LINQ benefits from compile-time checking and dymanic query composition.  To use LINQ include the following namespaces from System.Core assembly:

System.Linq
System.Linq.Expressions

LINQ consists of 2 basic data units, sequences and elements.  A sequence is defined as any object implementing the IEnumerable and elements are any item within the sequence.

To transform a sequence you use a method called query operator, which typical accept an input sequence and produce an output sequence.  The IEnumerable class in LINQ has around 40 or so query operators that are refered to as standard query operators.

A standard query expression would look as follows:

C#
using System;
using System.Collections.Generic;
using System.Linq;
namespace LINQSample
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] query = { "I", "Was", "Here" };  //String collection to query
            IEnumerable<string> filteredQuery = query.Where(n => n.Length >= 1);  //query with lambda expression.
            foreach (string q in filteredQuery)
                Console.Write(q + " ");
        }
    }
} //Console output: I Was Here