Last active
September 15, 2017 03:52
-
-
Save jamescurran/a5bc154106de28f3e210d23552faa5df to your computer and use it in GitHub Desktop.
TimeRange - Bad1
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
public void GenerateReport(DateTime endDate, TimeRange range) | |
{ | |
DateTime startDate; | |
switch(range) | |
{ | |
case TimeRange.OneYear: | |
startDate = endDate.AddYears(-1); | |
break; | |
case TimeRange.ThreeMonths: | |
startDate = endDate.AddMonths(-3); | |
break; | |
// etc | |
default: | |
throw new ArgumentOutofRangeException(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment