tags:

views:

37

answers:

2

I plan to ask another question on Stackoverflow but want to use the correct term. In recent years many APIs have been designed to support the following usage where a common type is returned.

var query= myList.Where(p=>p.X == "abc")
                   .Where(p=>p.BirthDate.Year == 1999)
                   .Where(p=>p.Y == 123 )
                   .Where(p=>p.Z == DateTime.Now );

What is the accepted software engineering term for this API style?

+5  A: 

This is typically known as a "Fluent" interface, where methods on an instance return the instance itself, allowing chaining like your example.

http://en.wikipedia.org/wiki/Fluent_interface

x0n
More stellar service from Stackoverflow.
camelCase
+1  A: 

The concept your talking about is Method Chaining

x0n is correct that is a concept used in a Fluent Interface.

ShaunLMason
True, the code sample employs method chaining, but he asked about the API style. APIs like this are usually described as "Fluent APIs," not "Method Chaining APIs."
x0n