I have this var, but I want to change it\'s content depending on the statement, I can\'t get it working because when I use it, VS says it has not been declared, even if the stat
Declare the variable outside the scope of the if statement:
IEnumerable days;
if (DateTime.Today.Day > 28 && DateTime.Today.Day < 2)
{
days = GetDaysLikeMe(calendario.Value.Date).Take(50).Where(d => d.Date.Day > 28 && d.Date.Day < 2).Take(4);
}
else
{
days = GetDaysLikeMe(calendario.Value.Date).Take(50).Where(d => d.Date.Day < 28 && d.Date.Day > 2).Take(4);
}