使用 LINQ 获取不在父列表中的项目列表
我正在 vb.net 中编写应用程序,
我有两个变量,一个包含 RoomRate 列表,另一个包含 RoomTypes 列表。
我们在 RoomRate 中将 RoomRates 和 RoomType 与 RoomTypeInfo 变量链接起来。
那么我如何找到没有定义 RoomRates 的 RoomType。
我的示例代码:
class RoomType
property UIN as integer
property Title as string
end class
class RoomRates
property UIN as integer
property RoomTypeInfo as RoomType
property Rate as double
end Class
myRoomRateList = RoomRates.GetData() 'List of RoomRates
myRoomTypeList = RoomTypes.GetData() 'List of RoomTypes
myRoomTypesWithNoRate = ???
I am writing app in vb.net
I have two variables one with list of RoomRate and other with list of RoomTypes.
We have RoomRates and RoomTypes linked with RoomTypeInfo variable insite the RoomRate.
So how do i find the RoomTypes which donot have the RoomRates Defined.
My Sample Code:
class RoomType
property UIN as integer
property Title as string
end class
class RoomRates
property UIN as integer
property RoomTypeInfo as RoomType
property Rate as double
end Class
myRoomRateList = RoomRates.GetData() 'List of RoomRates
myRoomTypeList = RoomTypes.GetData() 'List of RoomTypes
myRoomTypesWithNoRate = ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试这样的事情:
注意:这没有经过测试(甚至没有编译),但它应该给出这个想法。
Try something like this:
Note: this isn't tested (or even compiled), but it should give the idea.
未测试(我不在家)
这应该返回具有 myRoomTypeList 中不存在的 UIN 的所有 RoomType
Not Tested (I'm not at home)
This should return all the RoomTypes that has an UIN that is not present in myRoomTypeList