-5
所以我有一個類迭代通過一個普通的列表屬性
public class SearchViewModel<T> where T:class
{
public string LastSortColumn { get; set; }
public string LastSortDirection { get; set; }
public List<T> SearchItems;
public SearchViewModel(List<T> SearchItems)
{
this.SearchItems = SearchItems;
}
}
有沒有辦法,我可以通過一個foreach循環或一些財產SearchItems迭代什麼辦法? PS:SearchViewModel也是我的模型
當然,'foreach(SearchItems中的var元素)'{...}'。老實說:爲什麼不穀歌「如何在c#中迭代列表」? – HimBromBeere
@HimBromBeere是的,但SearchViewModel也是我的模型 – john
@john爲什麼會阻止你使用Google? – Servy