Fluent API Style Usage

Posted by Chris Dwyer on Stack Overflow See other posts from Stack Overflow or by Chris Dwyer
Published on 2010-03-08T16:55:57Z Indexed on 2010/03/08 17:06 UTC
Read the original article Hit count: 460

When programming against a fluent API, I've seen the style mostly like this:

var obj = objectFactory.CreateObject()
    .SetObjectParameter(paramName, value)
    .SetObjectParameter(paramName, value)
    .DoSomeTransformation();

What is the reasoning behind putting the dot at the beginning of the line instead of the end of the line like this:

var obj = objectFactory.CreateObject().
    SetObjectParameter(paramName, value).
    SetObjectParameter(paramName, value).
    DoSomeTransformation();

Or, is it merely a style thing that a team makes a consensus on?

© Stack Overflow or respective owner

Related posts about fluent-api

Related posts about coding-style