Can we define value from confirmed duplicates in 3 4 5 arrays & how?
Probably this is wrong path I take for finding duplicates, but better to ask than to roam
all over my small brain and eventualy delete this and get back to array matrix… I need to extract – define that int value that duplicates and later how much time in each of the 5 rows it exists. So to summarize: How to get that duplicated value "int" so I can use it for later checks.
public void Check()
{
var result1 = Row1.Any(L1 => Row2.Contains(L1) && Row3.Contains(L1)) == true;
var result2 = Row1.Any(L1 => Row2.Contains(L1) && Row3.Contains(L1) && Row4.Contains(L1)) == true;
var result3 = Row1.Any(L1 => Row2.Contains(L1) && Row3.Contains(L1) && Row4.Contains(L1) && Row5.Contains(L1)) == true;
if(result3 == true) { result1 = false; result2 = false; Debug.Log("Line 5"); }
if(result2 == true) { result1 = false; Debug.Log("Line 4"); }
if(result1 == true) { Debug.Log("Line 3"); }
}
>Solution :
If I’m reading your question correctly, you simply want the Intersect extension method, e.g.
int[] id1 = { 44, 26, 92, 30, 71, 38 };
int[] id2 = { 39, 59, 83, 47, 26, 4, 30 };
IEnumerable<int> both = id1.Intersect(id2);
foreach (int id in both)
Console.WriteLine(id);
/*
This code produces the following output:
26
30
*/