【发布时间】:2010-10-22 10:04:20
【问题描述】:
我想这是微不足道的,但对我来说不是。
我有一个集合MembershipUserCollection。我想对其执行一些 Linq 查询,所以我使用了OfType<MembershipUser>() 方法,然后在其上应用了Where()。但是,我不知道如何将结果返回到MembershipUserCollection?
这是我的代码:
MembershipUserCollection Users;
Users = GetAllUsers(pageIndex, pageSize, out totalRecords).OfType<MembershipUser>().Where(user => user.Email == emailToMatch); //how to cast it back to MembershipUserCollection ?
GetAllUsers(pageIndex, pageSize, out totalRecords) 正在返回 MembershipUserCollection
感谢您的宝贵时间。
【问题讨论】:
标签: c# .net linq collections casting