相关疑难解决方法(0)

相交()相反

Intersect可用于查找两个集合之间的匹配,如下所示:

// Assign two arrays.
int[] array1 = { 1, 2, 3 };
int[] array2 = { 2, 3, 4 };
// Call Intersect extension method.
var intersect = array1.Intersect(array2);
// Write intersection to screen.
foreach (int value in intersect)
{
    Console.WriteLine(value); // Output: 2, 3
}
Run Code Online (Sandbox Code Playgroud)

然而,我想要实现的是相反的,我想列出比较两个集合时缺少的项目:

// Assign two arrays.
int[] array1 = { 1, 2, 3 };
int[] array2 = { 2, 3, 4 };
// Call "NonIntersect" extension method.
var intersect = array1.NonIntersect(array2); // …
Run Code Online (Sandbox Code Playgroud)

.net c# collections intersect

264
推荐指数
5
解决办法
10万
查看次数

标签 统计

.net ×1

c# ×1

collections ×1

intersect ×1