out ref举例

 1  private static void Validate(string uid, string pwd, out string msg)
 2         {
 3             if (uid == "admin" && pwd == "888")
 4             {
 5                 msg = "登陆成功";
 6             }
 7             else if (uid != "admin" && pwd == "888")
 8             {
 9                 msg = "登录名错误";
10             }
11             else
12             {
13                 msg = "密码错误";
14             }
15         }
1    private static void Swap(ref int a, ref int b)
2         {
3             int temp = a;
4             a = b;
5             b = temp;
6         }
原文地址:https://www.cnblogs.com/cheshui/p/2701710.html