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?
You need to use:
for (DateTime d = _BookedCheckIn; d <= _BookedCheckOut; d = d.AddDays(1))
{
When you call d.AddDays
, it's returning a new DateTime, not changing the one you already created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With