Skip to content

Instantly share code, notes, and snippets.

@driscollwebdev
Created May 12, 2011 14:25
Show Gist options
  • Save driscollwebdev/968590 to your computer and use it in GitHub Desktop.
Save driscollwebdev/968590 to your computer and use it in GitHub Desktop.
Facade Implementation
public class MyClassFoo
{
public string Foo { get; set; }
public MyClassFoo(string foo)
{
Foo = foo;
}
public string DoSomethingWithFoo()
{
return String.Format("Foo says: {0}",Foo);
}
}
public class MyClassBar
{
public string Bar { get; set; }
public MyClassBar(string bar)
{
Bar = bar;
}
public string DoSomethingWithBar()
{
return String.Format("Bar says: {0}",Bar);
}
}
public class MyFacade
{
private MyClassFoo foo;
private MyClassBar bar;
public MyFacade()
{
foo = new MyClassFoo("Hi, I'm Foo!");
bar = new MyClassBar("Hi, I'm Bar!");
}
public string DoSomethingWithFooAndBar()
{
return String.Format("{0}{1}{2}",foo.DoSomethingWithFoo(),Environment.Newline,bar.DoSomethingWithBar());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment