You can have a list of Coordinates like:
public class Coordinate
{
public int X {get; set;}
public int Y {get; set;}
}
and your List as List<Coordinate>()
this way you can do it easily like:
bool exists = list.Any(l => l.X == x && x.Y == y);
However if you insist on having 2 separate lists, you can do it with a simple loop
int i = 0;
for(i=0;i<xList.Length;i++)
{
if(xList[i] == x && yList[i] == y) break;
}
if(i > xList.Length)
// not found
else
{
//i is the index
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…