Roy Osherove

View Original

Use VB.NET functionality from within C#

How:

1) Add a reference to Microsoft.VisualBasic Runtime frim the ".NET" references menu

2) Add a Using directive : "using Microsoft.VisualBasic;"

Voila! you have access to all of VB.NET's functionality, including 'Interaction.Inputbox()' and so on.

Being a VB programmer at heart, this is great news, although i suspect i will want to really get to know all of C# dialects for doing things before i use these shortcuts. however, it is nice to know that instead of creating a form that accepts user text as input and returns a dialogresult, i can just use good ol' "InputBox()" and save the trouble...

Another nice part is, that since you the VB.NET runtime is already a part of the Core Framework, there is no overhead in referencing this library. you get it for free!