泛型类和泛型方法1

using System;
using System.Collections.Generic;
using System.Collections;


class a<T>
{
	public void test<T>(T op1, T op2)
	{
		Console.Write("op1:"+op1.GetType()+"\top2:"+op2.GetType());
		Console.ReadLine();
	}
}

class b
{
	public static void Main()
	{
		a<string> A = new a<string>();
		
		A.test<string>("","Hello world!");
	}
}
using System;
using System.Collections.Generic;
using System.Collections;


class a
{
	public void test<T>(T op1, T op2)
	{
		Console.Write("op1:"+op1.GetType()+"\top2:"+op2.GetType());
		Console.ReadLine();
	}
}

class b
{
	public static void Main()
	{
		a A = new a();
		
		A.test<int>(1,1);
	}
}

 

 

posted @ 2012-02-17 00:50  solover  阅读(120)  评论(0)    收藏  举报