How do I start a program with arguments when debugging?

前端 未结 6 1923
南笙
南笙 2020-12-04 13:50

I want to debug a program in Visual Studio 2008. The problem is that it exits if it doesn\'t get arguments. This is from the main method:

if (args == null ||         


        
6条回答
  •  一生所求
    2020-12-04 14:36

    I would suggest using the directives like the following:

            static void Main(string[] args)
            {
    #if DEBUG
                args = new[] { "A" };
    #endif
    
                Console.WriteLine(args[0]);
            }
    

    Good luck!

提交回复
热议问题