为什么`NullableDatetime.Value`是只读的?

时间:2019-04-24 10:57:59

标签: c#

让我们将此代码NullableDatetime.Value设为只读。因此我无法指定为什么必须为read-only?有什么原因吗?如果它是只读的,那么在第三行中如何将其分配给DateTime。这是否意味着它再次为NullableDatetime创建了结构,并且为NullableDatetime指定了赋值?

    DateTime? NullableDatetime=null;
    NullableDatetime.Value = new DateTime();//Error
    NullableDatetime = new DateTime();

0 个答案:

没有答案
相关问题