Lambda 表达式转换为 Observable 集合
如果我有一个 Person 类型的对象,并且它有一个 PersonAddressJoin 的导航属性,然后它有地址。
PersonResults= new ObservableCollection<Person>(_op.Entities.OfType<Person>());
然后我想获取 PersonAddressJoin 导航属性并将其放入一个对象中。 所以我有一个 ObservableCollection AddressList,
AddressList = PersonResults.SelectMany(x => x.PersonAddressJoins);
当我这样做时,我收到一条消息,说我无法将 IEnumberable 转换为 ObservableCollection。?
有人可以帮我将该导航属性放入该对象中吗...谢谢
If I have an object of type Person and it has a navigation property of PersonAddressJoin which then has addresses.
PersonResults= new ObservableCollection<Person>(_op.Entities.OfType<Person>());
and I want to then take the PersonAddressJoin navigation property and put that into an object.
so i have an ObservableCollection AddressList
AddressList = PersonResults.SelectMany(x => x.PersonAddressJoins);
when i do it this way I get a message that says I cant cast an IEnumberable to an ObservableCollection.?
Can someone help me get that navigation property into this object...thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SelectMany 的结果是一个 IEnumerable。未经测试,但尝试:
The result of SelectMany is an IEnumerable. Untested, but try: