110,536
社区成员
发帖
与我相关
我的任务
分享
using System;
namespace Swap演示
{
class Program
{
static void swap<T>(ref T a ,ref T b)
{
T t = a;
a = b;
b = t;
}
static void Main(string[] args)
{
int i = 100, j = 200;
Console.WriteLine("i={0}\tj={1}",i,j);
swap(ref i, ref j);
Console.WriteLine("i={0}\tj={1}", i, j);
}
}
}