This is the code:
var numbers =
lightningsRegions.SelectMany(
s => Regex.Matches(s, @"\[(\d+)[ -]+(\d+)\]")
.Cast<Match>()
.Select(m => m.Groups.Cast<Group>().Skip(1).Select(x => x.Value)
.ToArray())
.Select(x => new { start = int.Parse(x[0]), end = int.Parse(x[1]) })
.SelectMany(x => Enumerable.Range(x.start, x.end - x.start + 1))
)
.ToList();
for (int i = 0; i < list_of_histogramsR.Count ; i++)
{
if (list_of_histogramsR[i] == numbers[i])
{
}
}
I consider the variable numbers as number of indexs. In the end numbers contain 5372 numbers.
So each number from thr 5272 is like an index.
Now i have this List<long[]> list_of_histogramsR wich contain 16595 indexs.
I want to check that if any number from numbers is in list_of_histogramsR as index number then do something.
For example the first number in numbers is 41. So when index number 41 of list_of_histogramsR == to the number 41 in numbers do something. Then the same for the next numbers in the variable numbers.
The problem is that on the IF line im getting error: Error 33 Operator ‘==’ cannot be applied to operands of type ‘long[]’ and ‘int’
Why ?
You can use
Containsto check if the list contains a specific number (cast the int to along):