D
David P. Donahue
Probably a simple question:
I have a function that receives as an argument a DateTime value. One of
the things I want to do is check to see if it's a weekday. So I do the
following (sorry for any wrapping):
if ((dateTimeStart.DayOfWeek != DateTime.DayOfWeek.Saturday) &&
(dateTimeStart.DayOfWeek != DateTime.DayOfWeek.Sunday))
{
...
}
But I get a compile error saying that an object reference is required,
which I assume is referring to the references to Saturday and Sunday,
since dateTimeStart is an object reference. How should I form this so
that I can compare my DateTime's DayOfWeek values with the enumerations?
-David P. Donahue
(e-mail address removed)
http://www.cyber0ne.com
I have a function that receives as an argument a DateTime value. One of
the things I want to do is check to see if it's a weekday. So I do the
following (sorry for any wrapping):
if ((dateTimeStart.DayOfWeek != DateTime.DayOfWeek.Saturday) &&
(dateTimeStart.DayOfWeek != DateTime.DayOfWeek.Sunday))
{
...
}
But I get a compile error saying that an object reference is required,
which I assume is referring to the references to Saturday and Sunday,
since dateTimeStart is an object reference. How should I form this so
that I can compare my DateTime's DayOfWeek values with the enumerations?
-David P. Donahue
(e-mail address removed)
http://www.cyber0ne.com