Question

I have a set of vb.net classes and functions that heavily rely on the

DateAndTime 

available in the

Microsoft.VisualBasic 

namespace.

Anyone knows if exists a "conversion table" for properties or methods somewhere (it seems SO doesn't)?

I would definitely like to avoid the need to reference VisualBasic.dll or start a trial and error process of figuring out the conversions if these are already done somewhere.

Thank you!

Was it helpful?

Solution

I don't know of any such conversion table.

The process of working out the equivalents shouldn't be too onerous, as you can decompile the DateAndTime class with Reflector or ILSpy.

Most are very straightforward (Date/Time arithmetic etc), and for the rest, most of the complexity is only needed to achieve backward compatibility for VB6.

For example DateSerial(int year, int month, int day) treats negative years as relative to the current date, and uses a calendar to convert 2-digit years to 4-digit years. If your app isn't making use of this, you can replace by a DateTime constructor.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top