How to get arguments of Main method in VB.NET


In C# Console Application, Main method has a string() argument, but in VB.NET, the Main method doesn't contain the argument, if I set command line arguments, how to retrieve them?

In C#, if I right click the project and select Properties, set command line arguments in debug item, I can use args[0], args[1] and so on to achive my arguments. In VB.NET, I found

System.Environment.GetCommandLineArgs()

can also achive them, but it contains one more argument, it also contains the path of the process, anyone can help?


Answers:


You could add them to the entry point method signature (ByVal args() As String) and access them just as you would in C#. You could also use VB.NETs My class to access them such as My.Application.CommandLineArgs.