- static void Main(string[] args)
- {
- Console.Write("请输入用户名:");
- string userName = Console.ReadLine();
- Console.Write("请输入密码:");
- string userPwd = Console.ReadLine();
- string str;
- bool b = Test(userName, userPwd, out str);
- Console.WriteLine("返回值{0},登陆状态:{1}", b, str);
- Console.ReadKey();
- }
- public static bool Test(string userName, string userPwd, out string str)
- {
- if (userName == "admin" && userPwd == "123456")
- {
- str = "登陆成功";
- return true;
- }
- else
- {
- str = "登陆失败";
- return false;
- }
- }
复制代码
|