What is the most elegant way to get a set of items by index from a collection?

后端 未结 14 2052
梦如初夏
梦如初夏 2020-12-13 04:57

Given

IList indexes;
ICollection collection;

What is the most elegant way to extract all T in

14条回答
  •  盖世英雄少女心
    2020-12-13 05:50

    It seems that the most efficient way would be to use a Dictionary instead of a Collection. You can still keep a list of indexes you want to use in the IList.

提交回复
热议问题