C#泛型
2021-03-01 21:27
///
/// 一个类来满足不同的具体类型,做相同的事儿
///
///
///
///
///
///
public class GenericClass
//, S, X, Eleven, 老K>
//where T : People
//where S : Chinese
//where Eleven : Hubei
{
public T _T;
}
///
/// 一个接口来满足不同的具体类型的接口,做相同的事儿
///
///
public interface IGenericInterface
{
T GetT(T t);//泛型类型的返回值
}
public class CommonClass
//: GenericClass
: IGenericInterface
{
public int GetT(int t)
{
throw new NotImplementedException();
}
}
public class GenericClassChild
//: GenericClass
: GenericClass
{
public Eleven GetT(Eleven t)
{
throw new NotImplementedException();
}
}
public delegate void SayHi