Remove hardcoded days from a IF statement
Posted on 2007-03-22
Wonder if you can help me?
I have the following code:
int todaysDay = DateTime.Today.Day;
if (todaysDay == 1 || todaysDay == 17 || todaysDay == 28 || someV = false)
// do something
The problem with that is I've had to hardcode the days i.e. 1,17,28 in the IF statement. Can someone please help me in getting the values i.e. 1,17,28 (or it could be more days) into a variable.
Something like this
string daysToSearch = "1,17,28"; // Please note, I will be getting the string "1,17,28" from a SQL field. Having got the "1,17,28" from SQL, I can then use this in the IF statement
Hope that makes sense?