I have menu xml like this:
<root>
<item name="submenu" href="">
<item name="delete post" href="example.com/delete" />
**<item name="delete post" href="" />**
**<item name="add post" href="" />**
<item name="add post" href="example.com/add" />
**<item name="add post" href="" />**
<item name="do not remove" href="" />
</item>
<item name="list post" href="example.com/list" />
**<item name="list post" href="" />**
<item name="remove only one of these" href="" />
**<item name="remove only one of these" href="" />**
</root>
I need to remove duplicate items and found a solution here: efficiently removing duplicate xml elements in c#
My problem is if there is href
filled I want to keep this exact record - so I need to sort them after grouping but before removing a record.
So I need to remove records marked with **
but can't get a way to make OrderBy(string.IsNullOrWhiteSpace)
work with GroupBy
.
Any help appreciated.