有用
来源:互联网 发布:淘宝卖男鞋的好店 编辑:程序博客网 时间:2024/06/10 04:40
static void Main(string[] args)
{
string a="liu";
string b="li";
Swap<string>(ref a,ref b);
Console.WriteLine("{0},{1}",a,b);
}
public static void Swap<T>(ref T a, ref T b)
{
T c ;
c = a;
a = b;
b = c;
}