Trying to create linq query from following xml.
<root>
<mileage value="100">
</mileage>
<mileage value="75">
</mileage>
<mileage value="60">
</mileage>
<mileage value="50">
</mileage>
</root>
The output needs to iterate xml tree getting all mileage values in mileage node and count each total when greater than or equal to 50, greater than or equal to 75 and greater than or equal to 100. So the output would be:
<root>
<mileage value="100" count="1"/>
<mileage value="75" count="2"/>
<mileage value="50" count="4"/>
</root>
Not sure where to begin
Here’s a piece of code that does exactly what you want. You should add error handling and consider the cases where not all the attributes are present or they are not what you expect (mileage value is not an int for example).