Blog - Title

C# 3.0, LINQ, and XLinq Nomenclature

C# 3.0, LINQ, and XLinq Nomenclature

  • Comments 2

[Blog Map]  This blog is inactive.  New blog: EricWhite.com/blog

Introduction

This post contains the nomenclature that I used in the XLinq documentation for the May 2006 CTP. Note that this is not the official list. It may change in the future.

query expression

This is the term for what has been called "query comprehension" in the past. An example of a query expression is:

var z =
from c in contacts.Elements()
where (string)c.Element("address").Element("state") == "WA"
select (string)c.Element("name");

expression

When you use the "explicit dot notation", it is simply an expression:

var z =
contacts.Elements()
.Where(c => (string)c.Element("address")
.Element("state") == "WA")
.Select(c => (string)c.Element("name"));

This expression follows a pattern called "Explicit dot notation".

lambda expression

The proposed term is "lambda expression", not something like in-line anonymous methods, or something. I don't believe that we should use the term "lambda", without expression.

from clause

This is the name of the 'from' clause in the query expression. A 'from clause' introduces an iteration variable. We can say that a 'from clause' iterates over an IEnumerable. 'From' is not an operator. It has been proposed that they be called generator or enumerator expressions. It has also been proposed to call it a declarative iterator.

projection

This is the term for what Select and GroupBy do. The term is not "set projection", just "projection".

declarative vs. imperative

A query expression is declarative in nature. Technically, this isn't strictly true. However, query expressions are 'more declarative' and less imperative than procedural code, but saying they are 'more declarative' will lead to 'more confusion', so I think it's OK to say that they are declarative.

object initializers

This is the term for the code that looks like this:

Person p = new Person {
    Name = "John Doe",
    Age = 31,
    CanCode = true
}

local variable type inference

This is the term for the use of the var keyword:

var i = 5;
var s = "Hello";
var d = 1.0;
var numbers = new int[] {1, 2, 3};
var orders = new Dictionary<int,Order>();

anonymous types

This is the term for:

var x = new {
    Name = "Eric",
    Phone = "555-1212"
};

extension method

This is the term for static methods defined in a static class where the first argument to the method has the this keyword on it.

expression tree

An expression tree is stored in the distinguished type, Expression<T>.

Leave a Comment
  • Please add 8 and 4 and type the answer here:
  • Post

  • There's an update to the LINQ extensions for the .NET framework available on MSDN. Check it out on...
Page 1 of 1 (2 items)