About C # Passing parameters and receiving parameters in the console
After writing the program for so long, I learned a basic knowledge point today, that is, what does the args parameter in the static void Main (string [] args) of the program entry mean? Ashamed... requirement: click a button to start an exe program and PASS Parameters to it. The Code is as follows: private void btnStart_Click (object sender, RoutedEventArgs e) {var rootPath = System. configuration. configurationManager. deleetask[ "rootPath"]; Process. start (rootPath + "xxx.exe", "This is the first parameter, this is the second parameter, and this is the third parameter");} console code: public class Program {static void Main (string [] args) {Console. writeLine (string. format ("received {0} Parameters", args. length); foreach (var item in args) {Console. writeLine (item );}}}