Skip to content

Instantly share code, notes, and snippets.

@jdunne
Created December 20, 2016 02:02
Show Gist options
  • Save jdunne/cea02d0bb1f98dc955a7199b96f35504 to your computer and use it in GitHub Desktop.
Save jdunne/cea02d0bb1f98dc955a7199b96f35504 to your computer and use it in GitHub Desktop.
interface IAuditor
{
void RecordThatSomethingWasDone();
}
class Service
{
private readonly IAuditor _defaultAuditor = new StandardAuditor();
public void DoSomething(IAuditor auditor = null)
  {
  // do something…
  if(auditor == null)
  {
  auditor = _defaultAuditor;
  }
  auditor.RecordThatSomethingWasDone();
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment