I have a foreach
that loops over two arrays
to check if the numbers are matching and in the same order as each other.
However one of the arrays
can have some extra numbers that I want to remove/ignore before comparing.
Example:
int[] currentTracingPoints = new int[] { 1,2,3,4 };
int[] part = new int[] {1,2,3};
I would like to remove the number 4 from currentTracingPoints
Example:
int[] currentTracingPoints = new int[] {4,5,6,8};
int[] part = new int[] {4,5,8};
I would like to remove the number 6 from currentTracingPoints
I am using Unity
foreach (TracingPart part in tracingParts) { // check tracing parts
if (currentTracingPoints.Count == part.order.Length && !part.succeded) {
// check whether the previous tracing parts are succeeded
if (PreviousLettersPartsSucceeded (part, tracingParts)) {
equivfound = true; // assume true
for (int i = 0; i < currentTracingPoints.Count; i++) {
int index = (int) currentTracingPoints [i];
if (index != part.order [i]) {
equivfound = false;
break;
}
}
}
}
}