using System; using System.Collections.Generic; using System.Text; ///Facade(外观)模式为子系统中的各类(或结构与方法)提供一个统一的接口/界面,隐藏子系统的复杂性,使子系统更加容易使用。 ///add by jzh 2007-04-15 namespace DesignPattern { class SubSystemA { public void OperationX() { Console.WriteLine("操作X"); } } class SubSystemB { public void OperationY() { Console.WriteLine("操作Y"); } } class SubSystemC { public void OperationZ() { Console.WriteLine("操作Z"); } } class Facade { private SubSystemA c1 = new SubSystemA(); private SubSystemB c2 = new SubSystemB(); private SubSystemC c3 = new SubSystemC(); public void OperationWrapper() { c1.OperationX(); c2.OperationY(); c3.OperationZ(); } } public class Client { public static void Main(string[] args) { Facade facade = new Facade(); facade.OperationWrapper(); Console.ReadLine(); } } }