Console app arguments, how arguments are passed to Main method

前端 未结 10 1174
醉话见心
醉话见心 2020-12-08 09:30

This would be question from c# beginner. When I create console application I get Main method with parameter args as array string. I do not understand how t

10条回答
  •  离开以前
    2020-12-08 10:24

    you can pass also by making function and then in this function you call main method and pass argument to main method

    static int Main(string[] args)
        {
    
    
            foreach (string b in args)
                Console.WriteLine(b+"   ");
    
            Console.ReadKey();
            aa();
            return 0;
    
        }
        public static void aa()
        {
            string []aaa={"Adil"};
    
            Console.WriteLine(Main(aaa));
        }
    

提交回复
热议问题