I’ve been working with Objective-C recently, and ran across a discussion of Cocoa Key Paths and Microsoft’s LINQ. With Microsoft LINQ (Language Integrated Query), you can do things like this:

public void Linq1() {
int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

var lowNums =
from n in numbers
where n < 5 select n; Console.WriteLine("Numbers < 5:"); foreach (var x in lowNums) { Console.WriteLine(x); } }

Resulting in:


That’s pretty cool. More complex examples make a built-in query language pretty handy. You can see more examples on Microsoft’s Linq examples page.

Cocoa has a similar feature, called key-value coding.

You can read more about how Apple’s OS X handles this in Matt Long’s posting over at the interestingly named “Cocoa Is My Girlfriend” blog.