C# While TryParse

后端 未结 4 1370
长情又很酷
长情又很酷 2021-01-23 08:45
char typeClient = \' \';
bool clientValide = false;
while (!clientValide)
{
     Console.WriteLine(\"\\nEntrez le type d\'employé (c ou g) : \");
     clientValide = cha         


        
4条回答
  •  执念已碎
    2021-01-23 09:14

    You can use ConsoleKeyInfo with Console.ReadKey() :

     ConsoleKeyInfo keyInfo;
     do {
       Console.WriteLine("\nEntrez le type d'employé (c ou g) : ");
       keyInfo = Console.ReadKey();
     } while (keyInfo.Key != ConsoleKey.C && keyInfo.Key != ConsoleKey.G);
       
    

提交回复
热议问题