Given
IList indexes;
ICollection collection;
What is the most elegant way to extract all T in
As I understand it, an ICollection may not necessarily have any order which is why there isn't an extremely elegant solution to access things by index. You many want to consider using a dictionary or list to store the data in the collection.
The best way I can think of is to iterate through the collection while keeping track of what index you are on. Then check if the indexes list contains that index. If so, return that element.