Merging two IEnumerables

前端 未结 3 1791
再見小時候
再見小時候 2020-12-09 01:20

I have two IEnumerables.

One gets filled with the fallback ellements. This one will always contain the most elements. The other one will get fi

3条回答
  •  情书的邮戳
    2020-12-09 01:32

    Try this.

    public static IEnumerable SmartCombine(IEnumerable fallback, IEnumerable translated) {
      return translated.Concat(fallback.Where(p => !translated.Any(x => x.id.equals(p.id)));
    }
    

提交回复
热议问题