How to get values out of IGrouping?

dotnetnoob picture dotnetnoob · Nov 19, 2013 · Viewed 14k times · Source

I have applied IGrouping<> over a list - here's what it looks like:

IEnumerable<IGrouping<TierRequest,PingtreeNode>> Tiers
{
    get { return ActiveNodes.GroupBy(x => new TierRequest(x.TierID, x.TierTimeout, x.TierMaxRequests)); }
}

Later in my code I iterate over Tiers. Its simple to get the key data using the Key element, but how do I get the IEnumerable<PingtreeNode> that forms the value part?

Thanks in advance

Answer

Vladimir picture Vladimir · Nov 19, 2013

Tiers.Select(group => group.Select(element => ...));