I have an Interface like this:
Public Interface TreeSelectorAttributes Property selectedInTreeSelector As Boolean Property Name As String ReadOnly Property childs As IEnumerable(Of TreeSelectorAttributes) End Interface
and I have a TreeView which has a List of this TreeSelectorAttributes:
Public Property rootList As IEnumerable(Of TreeSelectorAttributes)
now after the User chooses which elements he wants to select and which not I want to be able to return a Tree of all selected Elements but this property only returns the first layer of Elements:
Public ReadOnly Property checkedList As List(Of TreeSelectorAttributes) Get Return (From ele As TreeSelectorAttributes In rootList Where ele.selectedInTreeSelector = True).ToList() End Get End Property
How can I return also only the selected child Elements in this tree/list?
As pointed out in the comments I can't change the childs (ReadOnly) So my Idea would be to have in the Interface sth like a Property "selectedChilds"
Is that possible? The problem I see is that in an Interface I cant just implement the Property directly and I don't like the other options I see to do that: Have an Abstract Class with the implemented Property selectedChilds -> I don't like that because if I would do that every time ... Implement the Property myself everytime when I implement the Interface -> I don't like that because I will have CodeClones over CodeClones :/