Created
December 20, 2016 02:02
-
-
Save jdunne/cea02d0bb1f98dc955a7199b96f35504 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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