Facade pattern in the .NET BCL

The GoF facade pattern is used in scenarios where a lot of work happens in the background and the interfaces to those classes are exposed using a simple API. The XMLSeralizer class in the .NET BCL does quite a bit of its work behind the scenes and access to those routines are given using a very simple interface. The following code snippets create a DataSet to store a multiplication table for the number 42 (remember Douglas Adams!) and the XMLSeralizer class persists the table to a text file:

 class Program { private static DataSet CreateMultTable() { DataSet ds = new DataSet("CustomDataSet"); DataTable tbl = new DataTable("Multiplicationtable"); DataColumn column_1 = new DataColumn("Multiplicand"); DataColumn column_2 ...

Get .NET Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.