Friday, November 21, 2008

Visual Basic Functions in C#

Visual Basic functions in C# 2.0

by Mads Kristensen

Yet another great and useful article from Mads


If you used to be a VB developer, but for some reason are writing C# now, you probably miss a couple of functions. I remember being a little frustrated when I did the conversion from VB.NET to C#. It was March 2005 and I made the shift on the .NET 2.0 beta platform. I couldn’t understand why C# didn’t have some of the simplest functions like IsNumeric() and IsDate(). Also Left(), Right() and Middle() were missing. You could add a reference to the Microsoft.VisualBasic namespace, but that seemed like overkill for a few simple methods.
So I decided to make my own static class in C# 2.0 called VBFunctions that would implement exactly the four methods I was missing so much. This seems pretty basic and it is. But I use these functions again and again and now I have a single place to find them.

No comments:

Post a Comment