Fluent interfaces is a technique used in software development to implement an object-orientated API in such a manner that it provides more readable code, and it is usually implemented using method chaining.
Note
The term "fluent interface" was first used by Eric Evans and Martin Fowler. If you'd like to learn more about fluent interfaces, read Martin Fowler's blog post available at http://bit.ly/FluentInterfaces.
We'll create an HTML helper that will help us render Bootstrap alerts with a single line of code. The helper will take a fluent interface approach, which means that we'll be able to render a dismissible, warning alert box using the following line of code:
@Html.Alert("This is a warning").Warning().Dismissible()
To create fluent HTML helpers, complete the following steps: