Search in an Array

  • Thread starter Thread starter Sorin Sandu
  • Start date Start date
Hi Sorin,

Depending on your array setup and if those two values are separate or on the same row:

int[,] n = new int[4, 5];
for (int i = 0; i <= n.GetUpperBound(0); i++)
{
for (int j = 0; j <= n.GetUpperBound(1); j++)
{
if (n[i, j] == MyInt)
DoSomething();
}
}

int[,] n = new int[5, 2];
for(int i = 0; i <= n.GetUpperBound(0); i++)
{
if(n[i,0] == MyFirstValue && n[i,1] == MySecondValue)
DoSomething();
}
 
Back
Top