//Separate the construction of a complex object from its representation. //for creating complex objects that have multiple parts. static void Main(string[] _) { var htmlDoc = new HtmlDocumentBuilder() .SetTitle("title") .SetHeader("header") .SetBody("body") .SetFooter("footer") .Build(); Console.WriteLine(htmlDoc.ToString()); Console.ReadLine(); }
static void Main(string[] args) { IHtmlDocumentBuilder htmlDocumentBuilder = new HtmlDocumentBuilder(); var htmlDocument = htmlDocumentBuilder .SetTitle("Design Patterns") .SetHead("This is head") .SetBody("This body") .SetFooter("This is footer") .Build(); var htmlString = htmlDocument.ToString(); Console.WriteLine(htmlString); Console.ReadKey(); }