Note(4):C#ref用于局部变量和ref用于函数返回值
源代码:
static void Main(string[] args)
{
Way(c:2,a:1,b:3);
Way(c: true, a: false, b:true);
Way(c: "我", a: "来", b: "了");
Console.ReadLine();
}
public static void Way(int a, int b, int c)
{
Console.WriteLine($"{a.ToString()} {b.ToString()} {c.ToString()}");
}
public static void Way(bool a, bool b, bool c)
{
Console.WriteLine($"{a.ToString()} {b.ToString()} {c.ToString()}");
}
public static void Way(string a, string b, string c)
{
Console.WriteLine($"{a} {b} {c}");
}