using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication13
{
public interface ITest
{
T CreateIObject();
}
public class ITest<T, TI> : ITest<TI> where T : TI, new()
{
public TI CreatelObject()
{
return new T();
}
}
class Program
{
static void Main(string[] args)
{
ITest<System.ComponentModel.IListSource> itest = new Test<System.Data.DataTable, System.ComponentModel.IListSource>();
Console.WriteLine("数据类型为:\n" + itest.CreateIObject().GetType().ToString());
Console.ReadLine();
}
}
}
这段代码是关于泛型的使用的,不知为何,老是出错,还望名师指点一二,xiao'd在此先行谢过
错误:错误 1 “ConsoleApplication13.ITest”不实现接口成员“ConsoleApplication13.ITest.CreateIObject()”