Ahmad-Agha
جمعه 05 دی 1393, 15:05 عصر
با سلام من میخوام که از کاربر پسورد دریافت کنم برای شرط هاش مشکل دارم اگه میشه راهنمایی ؟؟
using System;
using System.Security;
namespace ConsoleApplication42
{
class Program
{
public static SecureString getPassword()
{
SecureString pwd=new SecureString();
while (true)
{
ConsoleKeyInfo i;
i = Console.ReadKey(true);
if ((Convert.ToInt32(i.Key) >= 65) & (Convert.ToInt32(i.Key) <= 90))
{
pwd.AppendChar(i.KeyChar);
Console.Write("*");
}
if (i.Key == ConsoleKey.Escape)
{
break;
}
else if (i.Key == ConsoleKey.Backspace)
{
if (pwd.Length > 0)
{
pwd.RemoveAt(pwd.Length - 1);
Console.Write("\b \b");
}
}
else
{
}
}
return pwd;
}
static void Main(string[] args)
{
getPassword();
}
}
}
}
using System;
using System.Security;
namespace ConsoleApplication42
{
class Program
{
public static SecureString getPassword()
{
SecureString pwd=new SecureString();
while (true)
{
ConsoleKeyInfo i;
i = Console.ReadKey(true);
if ((Convert.ToInt32(i.Key) >= 65) & (Convert.ToInt32(i.Key) <= 90))
{
pwd.AppendChar(i.KeyChar);
Console.Write("*");
}
if (i.Key == ConsoleKey.Escape)
{
break;
}
else if (i.Key == ConsoleKey.Backspace)
{
if (pwd.Length > 0)
{
pwd.RemoveAt(pwd.Length - 1);
Console.Write("\b \b");
}
}
else
{
}
}
return pwd;
}
static void Main(string[] args)
{
getPassword();
}
}
}
}