> I should add that the first time it is serialized, if Value is null it
> is serialized correctly (myControl.Value = null).
[quoted text clipped - 26 lines]
>
> > Nicolas
Your problem probably stems from the fact that DateTime is a
"structure" not a "class" and cannot be assigned the value null. Are
you using Nullable<DateTime> (also written DateTime?). Whenever we
use DateTime and need to represent "null", we either use
Nullable<DateTime> or simply assign it to DateTime.MinValue, and in
our data mapping code translate MinValue to DbNull and visa-versa.
I've noticed that there are several cases where the default
serialization can be a little finicky. In those cases, it is probably
a better idea to have your class extend ISerializable and implement
the serialization yourself. That way you know exactly what it is
doing.
VisualHint - 25 Apr 2007 00:11 GMT
Thank you. No I don't use a nullable type.
Anyway, I was able to solve the issue by checking the passed date to
see if Ticks==0 and in that case I force the value to null. This works
well.
Nicolas
On Apr 23, 1:18 pm, "ravi.s.de...@gmail.com" <ravi.s.de...@gmail.com>
wrote:
> > I should add that the first time it is serialized, if Value is null it
> > is serialized correctly (myControl.Value = null).
[quoted text clipped - 39 lines]
> the serialization yourself. That way you know exactly what it is
> doing.