I'm creating a helper class which should guide my co-workers in using it. Let's assume its a string-builder for proper building of a markdown-string.
string result = new OwnStringBuilder()
.NewTable()
.Tablehead("head1")
.Tablehead("head2")
.TableheadEnding()
.Tablecontent("content1")
.Tablecontent("content2")
.TableNextLine()
.Tablecontent("content3")
.Tablecontent("content4")
.EndTable()
It works properly as intended but I want to restrict the possibilities of the user.
When typing .NewTable. it shows all possible methods like Tablehead, TableheadEnding, Tablecontent, TableNextLine and EndTable.
I hope there is a way to restrict the table to use just the method tablehead.
The Tablehead just to use either another Tablehead or the TableheadEnding and so on.
The table itself is created via
public OwnStringBuilder NewTable()
{
return new OwnStringBuilder(this, StringBuilder.AppendLine());
}
and e.g. the Tablehead via
public OwnStringBuilderTableHelper Tablehead(string content)
{
StringBuilder.Append(content);
return this;
}
I've already googled but it's already rare to get good examples for this.