There are many correct answers to this right now, but here is the "teach a guy to catch" version.
First, create a tiny console application in C #:
class Test { static void Main() { var strings = new string[] {"abc", "def", "ghi"}; } }
Compile it, saving the debug information:
csc /debug+ Test.cs
Launch Reflector and open the Main method, and then decompile VB. You get:
Private Shared Sub Main() Dim strings As String() = New String() { "abc", "def", "ghi" } End Sub
Thus, we got the same answer, but without knowledge of VB. This will not always work, and there are many other conversion tools, but this is a good start. Definitely worth a try as the first port of call.
Jon Skeet Nov 14 '08 at 21:16 2008-11-14 21:16
source share