我的代码:
public class MyClass
{
private WdmEntities _context;
public List<T> GetTable<T>()
{
List<T> res = new List<T>();
_context = new DbEntities();
if (typeof(T) == typeof(tables))
res = _context.tables.ToList();//error cannot implicitly convert type
if (typeof(T) == typeof(columns))
res = _context.columns.ToList();//error cannot implicitly convert type
return res;
}
}
我有来自EntityModel的表和列类型
但我得到了编译错误:
cannot implicitly convert type
我必须如何更改我的代码才能使其工作?