Convert or Return Model.Content.Site() as an "Editable" object such as List and not an IEnumerable
I need to filter / remove child collections (Sub Pages) that meet a certain criteria. The IEnumerable returned from Model.Content.Site() is uneditable, and i don't want to have to duplicate the entire hierarchy over to an editable list. Is there a way of returning the Content object as a List or an editable object?
Sorry i should have been clearer with my question.
I also need the collections within the children to be Lists also.
When i use ToList() it will just convert the Children i call ToList on and not its child collections also.
To give some context its for a navigation that will be 3 levels deep, and i will need to remove nodes on any of the levels.
I was hoping that i wouldn't have to iterate over several levels of IEnumerable Collections converting to Lists and rebuilding the hierarchy in another object.
Convert or Return Model.Content.Site() as an "Editable" object such as List and not an IEnumerable
I need to filter / remove child collections (Sub Pages) that meet a certain criteria. The IEnumerable returned from Model.Content.Site() is uneditable, and i don't want to have to duplicate the entire hierarchy over to an editable list. Is there a way of returning the Content object as a List or an editable object?
Hi Keith
You can use copy of list and make it editable:
Alex
Hi Alex,
Sorry i should have been clearer with my question.
I also need the collections within the children to be Lists also.
When i use ToList() it will just convert the Children i call ToList on and not its child collections also.
To give some context its for a navigation that will be 3 levels deep, and i will need to remove nodes on any of the levels.
I was hoping that i wouldn't have to iterate over several levels of IEnumerable Collections converting to Lists and rebuilding the hierarchy in another object.
Regards,
Keith
is working on a reply...