How to pass parameters to a console application?

There is a console application, for example consoleApp.exe
How to pass variables and values to the console? That is:
consoleApp.exe -a1 c:\\file_test1.txt -a2 c:\\file_test2.txt -out c:\\file_result.txt
What to write in Main(string[] args) to accept these values?
class Program
{
 static void Main(string[] args)
{

 // string a1 = (received specified value from the console), etc. a2, out
}
 }
March 25th 20 at 13:33
1 answer
March 25th 20 at 13:35
Solution
Of. tutorial: https://docs.microsoft.com/ru-ru/dotnet/csharp/pro...

Everything is already sewn :)
Thank you! And it is possible to specify in the console the name of the variable? for example, as mentioned above:
I write in the console consoleApp.exe -a1 c:\\file_test1.txt i.e. -a1 the name of the variable, the value c:\\file_test1.txt and then I get an array of strings, ie. if I enter a1, the console counts as a parameter, as a string - sigurd commented on March 25th 20 at 13:38
@sigurd, finished condition, that if the argument N is equal to "a1", then N+1 equal to its value. - Michele.Torphy commented on March 25th 20 at 13:41
@sigurd, as I have done - checked the first character is '-' then threw it in the dictionary as the key, and the following argument as value. If this is not an option then added this value to the list, as file names. - elyse commented on March 25th 20 at 13:44
@sigurd, the names of the variables - your personal fantasy. In compiled code they are replaced with a pointer to the memory address. So, having an array of strings, you're supposed to parse what is what. - duane.Cri commented on March 25th 20 at 13:47

Find more questions by tags C#