易丰科技
标题:
C# 以前没用过的一个类 SecureString
[打印本页]
作者:
Calvin
时间:
2011-10-3 20:18
标题:
C# 以前没用过的一个类 SecureString
// Instantiate the secure string.
SecureString securePwd = new SecureString();
ConsoleKeyInfo key;
Console.Write("Enter password: ");
do
{
key = Console.ReadKey(true);
// Ignore any key out of range.
if (((int)key.Key) >= 48 && ((int)key.Key <= 90))
{
// Append the character to the password.
securePwd.AppendChar(key.KeyChar);
Console.Write("*");
}
// Exit if Enter key is pressed.
} while (key.Key != ConsoleKey.Enter);
Console.WriteLine();
try
{
Process.Start("Notepad.exe", "calvin", securePwd, "PC-05");
}
catch (Win32Exception e)
{
Console.WriteLine(e.Message);
}
复制代码
欢迎光临 易丰科技 (http://forum.yftek.com/)
Powered by Discuz! X3