using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GenericInterface1
{
class Program
{
public interface MyGenericInterface<T>
//T 是类型参数。在实例化泛型的时候,可以使用约束对参数类型的种类进行限制。
//定义一个泛型接口,泛型接口的声明与普通接口的声明的唯一区别是增加了一个T
//泛型类型声明所实现的接口必须对所有可能的构造类型都保持唯一。
//否则就无法确定该为某些构造类型调用哪个方法。
{
T Create();//接口调用Create方法。
}
//实现上面泛型接口的泛型类
//派生约束where T:TI(T要继承TI)
//构造函数约束where T:new(可以实例化)
public class Factory<T,TI>:MyGenericInterface<TI> where T : TI, new()
{
//public TI Create()
//{
// throw new NotImplementedException();
//}