How to we call multiple optional functions in one line?

Viewed 3480

Consider I have multiple functions in my simple server framework as shown below, It takes multiple functions like this :

new TestServer()
    .DOBind("ip", "port")
    .SetMaxBindTries(3)
    .SetMaxConnections(300)
    .ONBind(delegate {...})
    .ONReceiveBytes(delegate {...})
    .ONSocketStatusChanged(delegate {...})
    .ONBlaBlaBla...

my question: - How can I do something like this ? - What are the "special key words" to investigate ? - What kind of "class-design / design-pattern" structure should I follow ?

Any pointers appreciated.

2 Answers
Related