對象我有這種情況:創建泛型類的列表
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