Microsoft Newsserver <(E-Mail Removed)> wrote:
> Im having a bit of difficulty working out how to do the following.
>
>
> method ( paramType? param1, DateTime? requiredByDate , paramType? param3)
>
>
> I have a row property which I need to pass to this method, this has a
> property of IsNull which is a boolean, so I tried to do the following
>
> method ( param1,
> row.IsRequiredByDateNull() ? null, row.RequiredByDate,
> param3 )
>
> This fails on compile because it cant cast from a null to a DateTime.
>
> How can i construct this ?
Don't cast to DateTime - cast to DateTime? (with the question mark).
Then it should be fine.
--
Jon Skeet - <(E-Mail Removed)>
Web site:
http://www.pobox.com/~skeet
Blog:
http://www.msmvps.com/jon_skeet
C# in Depth:
http://csharpindepth.com