Question: 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.

Answer: 
No secret keyword or design here. What happens is that each of these methods returns the instance of the TestServer (simply by returning `this`):

```
TestServer DoThis()
{
    // method code
    return this;
}

TestServer DoThat(string WithThisParameter)
{
    // method code
    return this;
}

```

And then you can do this:

```
var x = new TestServer();
x.DoThis().DoThat("my string").DoThis();

```

Apparently, as Vache dee-see wrote in the comments, this is called ["fluent API"](https://en.wikipedia.org/wiki/Fluent_interface#C.23)
```
class TestServer 
{
    string x = "";
    string y = "";
    string z = "";

    TestServer SetX(string val)
    {
        x = val;
        return this;
    }

    TestServer SetY(string val)
    {
        y = val;
        return this;
    }

    TestServer SetZ(string val)
    {
        z = val;
        return this;
    }
}

```

then you can do it like this

```
new TestServer().SetX("blbablabla").SetY("Blablabla").SetZ("blablabla");

```