Set operator

Distinctapp

去重
Returns distinct values from a collection.spa

Except code

取差集
Returns the difference between two sequences, which means the elements of one collection that do not appear in the second collection.blog

  1. IList<string> strList1 =newList<string>(){"One","Two","Three","Four","Five"};
  2. IList<string> strList2 =newList<string>(){"Four","Five","Six","Seven","Eight"};
  3. var result = strList1.Except(strList2);
  4. foreach(string str in result)
  5. Console.WriteLine(str);
  6. Results:
  7. One
  8. Two
  9. Three

Intersectelement

取并集
Returns the intersection of two sequences, which means elements that appear in both the collections.string

Union it

取交集
Returns unique elements from two sequences, which means unique elements that appear in either of the two sequences.io

图示

相关文章
相关标签/搜索