C# – Implications in using VB.NET method DateAndTime.DateDiff with C#

asp-classicasp.netvb.net-to-c#

I'm building a new ASP.NET web application based on a legacy one (Classic ASP). The people, who build this code 4, 5 years ago, used a lot of VBScript functions like DateDiff.

I'm currently working on a simulator that does a lot of calculations with dates. And I'm getting a annoying difference between these dates because I don't have a easily manner to get the difference between months in c# like they did in VB 6.

So, I choose the path of using the DateAndTime.DateDiff from Microsoft.VisualBasic namespace on my ASP.NET web application.

You guys know if there are some implications on that? I'm a little concerned with this approach.

Cheers,

Best Answer

The only implication is that you're adding another assembly to your deployment, and using functionality that many C# developers (other people that might need to maintain your code) are not aware of. But personally I don't think there's much wrong with it. The MSDN Library documentation is typically good, and you can also add a few comments if you want to explain why your using it.

Edit: I also want to note that Microsoft.VisualBasic was implemented from scratch for .NET. It does not contain ancient code.

Related Topic