日期:2014-05-18  浏览次数:21142 次

急!未能找到类型或命名空间名称“T”
小弟要定义一个以List<T>为返回值的函数,代码如下:
public List<T> FindAllAsObject(ref T t,string colname)
  {
  MongoCursor<T> allobjects = this.database[colname].FindAllAs<T>();
  List<T> results = new List<T>();
  foreach (T result in allobjects)
  {

  results.Add(result);
   
  }
  return results;
  }
系统总提示未能找到类型或命名空间“T”
我已经引用了system.collection.generic

------解决方案--------------------
public List<T> FindAllAsObject<T>(ref T t,string colname)
加上这个
------解决方案--------------------
public List<T> FindAllAsObject<T>(ref T t, string colname)
------解决方案--------------------
探讨
public List<T> FindAllAsObject<T>(ref T t, string colname)

------解决方案--------------------
探讨

public List<T> FindAllAsObject<T>(ref T t, string colname)