Skip to content

Instantly share code, notes, and snippets.

@jamescurran
Last active September 15, 2017 03:52
Show Gist options
  • Save jamescurran/a5bc154106de28f3e210d23552faa5df to your computer and use it in GitHub Desktop.
Save jamescurran/a5bc154106de28f3e210d23552faa5df to your computer and use it in GitHub Desktop.
TimeRange - Bad1
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