how to call “ static void Main(string[] args) ”in the class again

后端 未结 5 433
渐次进展
渐次进展 2021-01-23 20:53

i am new in C# and working on Console Applications now a days i wrote the following code :

Program.cs

using System;
using System.Collect         


        
5条回答
  •  执念已碎
    2021-01-23 21:16

    Firstly, your label is incorrect. The end of a label should have a colon character :.. so your label should have been this:

    StartPoint:
    

    However:

    You should just loop until a condition is met. In this case.. the condition is to not restart:

    bool running = true;
    
    while (running) {
        /* 
         * all of your other code
         * should go here
         */
        if (selectedOption != "y") {
            running = false;
        }
    }
    

提交回复
热议问题