Passing argument to Main method in Visual Studio

To pass arguments to Main method in Visual Studio we can go to the following path:

Right-click on project → Properties → Debug tab → Application arguments

We can write down new arguments there:

Debug tab – Application arguments

And we can use our added arguments with args[] and the appropriate index e.g. args[0], args[1]:

Main(string[] args) method and using arguments
The result of the method with the displayed argument values

Leave a comment