Home
Manage Your Code
Snippet: Get and check the key from console (C#)
Title: Get and check the key from console Language: C#
Description: Get and check the keys input from console Views: 132
Author: Yan Xing Yang Date Added: 8/4/2008
Copy Code  
1			Console.Write("Please enter password: "); 
2			while (true) 
3			{ 
4				ConsoleKeyInfo cki = Console.ReadKey(true); 
5				if (cki.Key == ConsoleKey.Enter) break; 
6				// Append password characters into the SecureString 
7				stringBuilder.Append(cki.KeyChar);
8				Console.Write("*");
9			}
10