-
Notifications
You must be signed in to change notification settings - Fork 2
VB.Net usage of Date type #29
Comments
As I thought... because we define the type as By default Dim d as Date ' d will be a System.DateTime, not our System.Date We can escape the keyword: Dim d as [Date] But then we get the compiler error:
I can think of two changes that would fix the problem, neither of which I particularly like:
The option pointed out by @paulirwin of having the VB language get an Any other ideas? FWIW - I already explored using |
Agreed that neither are good options, but of those, I'd vote for using CalendarDate. |
You wrote
I think you did something wrong. That works for me. I suspect you have two different definitions of |
Interestingly, it works just fine when compiled from VS2015, but not when compiled from VS2013. Did we stumble upon a difference with the Roslyn vs traditional compilers? I think if it works in 2015, that should be good enough for .NET Core, right? |
@gafter - Any idea why |
No answer, ok. Perhaps @ljw1004 might have an idea? Specifically, I'm wondering what's different about the Roslyn-based VB compiler that allows Can I count on it continuing to work? Or is it working by accident due to some oversight in the compiler? Thanks in advance. |
Roslyn is doing the right thing and you can count in it continuing to work. It's hard to imagine what the VS2013 VB compiler is thinking here. I don't believe the old compiler gets stuck on |
Cool. Thanks for looking into it. I appreciate your insight! |
Since VB has its own
Date
keyword as part of the language, and this is mapped explicitly toSystem.DateTime
, we need to document what workarounds are required to useSystem.Date
in a VB.Net project.This assumes no new language changes. It's conceivable at some point in the future that an
Option
flag could be added to the language to disable the built-in mapping, but for now we'll assume that it doesn't exist.The text was updated successfully, but these errors were encountered: