Skip to content

Instantly share code, notes, and snippets.

@adamralph
Created July 5, 2012 06:19
Show Gist options
  • Save adamralph/3051724 to your computer and use it in GitHub Desktop.
Save adamralph/3051724 to your computer and use it in GitHub Desktop.
RE: 3047138
public class Different
{
private ISomething something;
public Different(ISomethingProvider somethingProvider)
{
this.something = somethingProvider.Provide();
}
}
public class SomethingProvider : ISomethingProvider
{
ISomething Provide()
{
if (...)
{
return new SomethingA();
}
else
{
return new SomethingB();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment