原文链接:http://blog.youkuaiyun.com/u013108312/article/details/52051211
泛型方法是使用类型参数声明的方法,如下所示:
C#
static void Swap<T>(ref T lhs, ref T rhs)
{
T temp;
temp = lhs;
lhs = rhs;
rhs = temp;
}
下面的代码示例演示一种使用 int 作为类型参数的方法调用方式:
C#
public static void TestSwap()
{
<