外观模式把其他对象的方法统一到另外一个接口对象之内,调用一个方法进行
using System;
using System.Reflection;
namespace FacadeSample
{
class Program
{
static void Main(string[] args)
{
abstractFace ef;
string FaceNamw= "FacadeSample.FaceSample";
if (FaceNamw == "FacadeSample.FaceSample")
{
ef = (abstractFace)Assembly.Load("FacadeSample").CreateInstance(FaceNamw);
ef.Memthod();
Console.ReadKey();
}
}
}
class subsystemA
{
public void method()
{
Console.WriteLine("方法1");
}
}
class subsystemB
{
public void method()
{
Console.WriteLine("方法2");
}
}
abstract class abstractFace
{
public abstract void Memthod();
}
class FaceSample: abstractFace
{
private subsystemA objA;
private subsystemB objB;
public override void Memthod()
{
objA = new subsystemA();
objB = new subsystemB();
objA.method();
objB.method();
}
}
}