开发者

What is the proper term for an API designed around the dotted notation?

开发者 https://www.devze.com 2023-01-17 03:30 出处:网络
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.

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(开发者_Python百科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?


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


The concept your talking about is Method Chaining

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

0

精彩评论

暂无评论...
验证码 换一张
取 消