IEnumerable リストを BindingList コレクションにキャストすることは可能ですか?
IEnumerable リストは、次のような型付きオブジェクトのリストです。
IEnumerable<AccountInfo> accounts = bll.GetAccounts(u.UserName, u.Password);
そして、私の PagingList は BindingList を拡張するだけです:
public class PagingList<T>
{
public BindingList<T> Collection { get; set; }
public int Count { get; set; }
public PagingList()
{
Collection = new BindingList<T>();
Count = 0;
}
}
PagingControl でリストをレンダリングするメソッドに IEnumerable リストを渡したかっただけです。
protected void RenderListingsRows(PagingList<AccountInfo> list)
{
foreach (var item in list)
{
//render stuff
}
}
しかし、私は2つの間でキャストできないようです.誰かが私が欠けているものを指摘できますか?!
どうもありがとう
ベン