Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我被要求找出如果 Web 表单上的日期字段留空,为什么 ajax 调用不起作用,发现很容易,因为该VB函数需要一个具有 Date 类型的对象。
VB
我要将这些值转换为Nullable(Of Date),但我很不情愿,因为这是一个被大量使用的类,我不想破坏其他任何东西。
Nullable(Of Date)
然而,我的想法是,调用这个类的所有东西都必须发送正确的日期,否则它当前会抛出错误,所以我应该没问题。
只要我使用检查值HasValue并使用日期取出,Value那么我应该没有任何问题,或者还有其他我需要考虑的事情吗?
HasValue
Value
如果您更改每个引用以使用 Date 的 Value 属性,它不会比您现在拥有的更差。然后,您可以在需要的地方添加 HasValue 检查。