I’m trying to make use for on a DateTime like this:
for (DateTime d = _BookedCheckIn; d <= _BookedCheckOut; d.AddDays(1))
{
// ...
}
But the problem is that d does not increase. Does anyone have an idea of what the problem is?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to use:
When you call
d.AddDays, it’s returning a new DateTime, not changing the one you already created.