.NET 4.0 日历控件成员 SelectedDate 的类型为“DateTime?”?

发布于 2024-09-25 13:21:41 字数 78 浏览 0 评论 0原文

在 .NET 4.0 中,如果创建日历并查看 SelectedDate 字段,它的类型为“DateTime?”。到底是怎么回事?在类型的末尾?

In .NET 4.0 if you create a Calendar and you look at the SelectedDate field it is of type "DateTime?". What's the deal with the ? at the end of the type?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

等数载,海棠开 2024-10-02 13:21:41

?最后意味着它可以为空,例如,控件可能根本没有 SelectedDate。

看:
http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx

? at the end means it's nullable, as in, the control may not have a SelectedDate at all.

See:
http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx

红衣飘飘貌似仙 2024-10-02 13:21:41

?最后意味着值类型也可以为 null。

? at the end means that a value type can also be null.

樱花坊 2024-10-02 13:21:41

DateTime? 表示 Nullable,这意味着该属性可以保存 null。同时只是 DateTime - 不能。

在 MSDN 上查看有关 可空类型的更多信息

DateTime? means Nullable<DateTime> that's meaning that this property can hold null. Meanwhile just DateTime - cannot.

See more about Nullable Types on MSDN

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文