是否在母子收集的X项子收集中为母子收集的滤滤过滤器储存良好做法?
Class ItemCollection : Inherits Collection(Of Item)
Private _types as New List(Of ItemCollection) //Cache
Function FilterByType(type) As ItemCollection
If Not _types.KeyExists(type) Then
_types.Add(type, New ItemCollection())
For Each i in Me
If i.Type = type Then _types(type).Add(i)
Next
End If
Return _types(type)
End Function
//Same for FilterByColor(color)
End Class
Class Item
Public Color = "Blue"
Public [Type] = "One"
End Class