Nullable DateTimes and the AddDays() extension

前端 未结 4 1175
暗喜
暗喜 2021-01-12 02:34

I have a DateTime variable that can either be null or a Datetime. I figured a nullable DateTime type would work, but I am getting an error telling me that said

4条回答
  •  长情又很酷
    2021-01-12 02:58

    If you look at the documentation for the Nullable type, you'll see it only has a few members. The Value member will get you the T inside, if the Nullable container has a value. The Nullable doesn't borrow any members from the type T it wraps.

提交回复
热议问题