I have Window Application in VB.Net. I have following Classes & Enum.
Public Class Page
Public Property Name As String
Public Property PageItems As List(Of PageItem)
End Class
Public Class PageItem
Public Property ItemName As String
Public Property mode As Mode
End Class
Public Enum Mode
Mode1
Mode2
End Enum
In my application I have a List(Of Page)
property. One Page
may have multiple PageItem
and also PageItem.ItemName
can be duplicated with different modes. e.g. Application can have a PageItem
with Mode1
and Mode2
(Here it's possible that Mode1
item may in Page(0)
and Mode2
item may in Page(1)
)
My Question is How to find a PageItems
List
(Same ItemName
) which have both Mode1
and Mode2
from a List(Of Page)
property using LINQ ?
Example:
Page 1 has 3 Items {Item1, Mode1}, {Item2,Mode1}, {Item3,Mode2}
Page 2 has 2 Items {Item1, Mode2}, {Item4, Mode1}
Here I want a PageItems
list which have both mode Mode1
& Mode2
. In the above case the result should be {Item1, Mode1}, {Item1, Mode2}
(Item1
have both Modes
)