Skip to content

Instantly share code, notes, and snippets.

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