Logic for capturing unique characteristics in an object array. C# LINQ [closed]
- by Shawn H.
Given the following "response" or array of objects, what would be the most efficient way to get the desired results. There must be an easier way than the exhaustive and tedious way I'm doing it now. A LINQ solution would be fantastic.
Situation #1
<things>
<thing id="1">
<feature>Tall</feature>
</thing>
<thing id="2">
<feature>Tall</feature>
</thing>
<thing id="3">
<feature>Tall</feature>
<feature>Wide</feature>
</thing>
<thing id="4">
<feature>Tall</feature>
</thing>
</things>
Result:
Wide
Situation #2
<things>
<thing id="1">
<feature>Short</feature>
</thing>
<thing id="2">
<feature>Tall</feature>
</thing>
<thing id="3">
<feature>Tall</feature>
<feature>Wide</feature>
</thing>
<thing id="4">
<feature>Tall</feature>
</thing>
</things>
Result:
Wide, Short, Tall
Situation #3
<things>
<thing id="1">
<feature>Tall</feature>
<feature>Thin</feature>
</thing>
<thing id="2">
<feature>Tall</feature>
</thing>
<thing id="3">
<feature>Tall</feature>
<feature>Wide</feature>
</thing>
<thing id="4">
<feature>Tall</feature>
</thing>
</things>
Result:
Wide, Thin
Thanks.