Project Description

NLinq is a framework focusing on reimplementing the Linq functionnalities in Visual Studio .Net 2003 and Visual Studio 2005 (C# & VB .Net) by providing a Linq grammar parser and a "Linq To Objects" execution environment. With NLinq you can take advantage of major C# 3.0 features right now, without requiring it.

See some samples or how NLinq handles some of the Linq 101 Samples.
You can also read the Skeptical Faq for common questions about NLinq.

Sample Usage

The goal is to implement this query: "Get all the instance methods on System.String, ordered by name and grouped into overloads, each with the name of the overloaded member and the number of overloads."

  query = new NLinqQuery(
    @"  from m in methods
          where !m.IsStatic
          orderby m.Name
          group m by m.Name into g
          select new { MethodName = g.Key, Overloads = g.Count() }");
 
  linq = new LinqToMemory(query);
  linq.AddSource("methods", typeof(string).GetMethods());
 
  foreach (object o in linq.Enumerate())
  {
     Console.WriteLine(o);
  } 

Result

{ MethodName = Clone; Overloads = 1; }
{ MethodName = CompareTo; Overloads = 2; }
{ MethodName = Contains; Overloads = 1; }
{ MethodName = CopyTo; Overloads = 1; }
{ MethodName = EndsWith; Overloads = 3; }
{ MethodName = Equals; Overloads = 3; }
{ MethodName = get_Chars; Overloads = 1; }
{ MethodName = get_Length; Overloads = 1; }
{ MethodName = GetEnumerator; Overloads = 1; }
{ MethodName = GetHashCode; Overloads = 1; }
{ MethodName = GetType; Overloads = 1; }
{ MethodName = GetTypeCode; Overloads = 1; }
{ MethodName = IndexOf; Overloads = 9; }
{ MethodName = IndexOfAny; Overloads = 3; }
{ MethodName = Insert; Overloads = 1; }
{ MethodName = IsNormalized; Overloads = 2; }
{ MethodName = LastIndexOf; Overloads = 9; }
{ MethodName = LastIndexOfAny; Overloads = 3; }
{ MethodName = Normalize; Overloads = 2; }
{ MethodName = PadLeft; Overloads = 2; }
{ MethodName = PadRight; Overloads = 2; }
{ MethodName = Remove; Overloads = 2; }
{ MethodName = Replace; Overloads = 2; }
{ MethodName = Split; Overloads = 6; }
{ MethodName = StartsWith; Overloads = 3; }
{ MethodName = Substring; Overloads = 2; }
{ MethodName = ToCharArray; Overloads = 2; }
{ MethodName = ToLower; Overloads = 2; }
{ MethodName = ToLowerInvariant; Overloads = 1; }
{ MethodName = ToString; Overloads = 2; }
{ MethodName = ToUpper; Overloads = 2; }
{ MethodName = ToUpperInvariant; Overloads = 1; }
{ MethodName = Trim; Overloads = 2; }
{ MethodName = TrimEnd; Overloads = 1; }
{ MethodName = TrimStart; Overloads = 1; }

Original idea for this query: LukeH http://blogs.msdn.com/lukeh/archive/2007/03/31/in-memory-query-with-c-2-0-and-c-3-0.aspx

People behind NLinq

petit_carre.png

NLinq is a project managed by the people of Evaluant and is a part of its R&D developments

Last edited Aug 8, 2008 at 10:08 AM by sebastienros, version 19