对象我有这种情况:创建泛型类的列表
public class ExtResult<T>
{
public bool Success { get; set; }
public string Msg { get; set; }
public int Total { get; set; }
public T Data { get; set; }
}
//create list object:
List<ProductPreview> gridLines;
...
...
//At the end i would like to create object
ExtResult<gridLines> result = new ExtResult<gridLines>() {
Success = true, Msg = "",
Total=0,
Data = gridLines
}
但我得到一个错误:
error: "cannot resolve gridLines"
我能做些什么来解决这个问题?
“*什么是正确的方法?*” - 做什么? (并且最可能的答案是了解泛型) – Amit