Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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