You better use a HashSet or Dictionary ( If you need to keep them in a specific order ) to ensure that they are really unique.
Then you should override GetHashCode and Equals to check the equality.
Best practice for GetHashCode: What is the best algorithm for an overridden System.Object.GetHashCode?
Implementation
public class Coordinate
{
public Int32 X { get; set; }
public Int32 Y { get; set; }
public override int GetHashCode()
{
Int32 hash = 17;
hash = hash * 23 + X;
hash = hash * 23 + Y;
return hash;
}
public override Boolean Equals(object obj)
{
Coordinate other = obj as Coordinate;
if (other != null)
{
return (other.X == X) && (other.Y == Y);
}
return false;
}
}
Dictionary
Int32 count = 0;
Dictionary<Coordinate, Int32> cords = new Dictionary<Coordinate, Int32>();
// TODO : You need to check if the coordinate exists before adding it
cords.Add(new Coordinate() { X = 10, Y = 20 }, count++);
// To get the coordinates in the right order
var sortedOutput = cords.OrderBy(p => p.Value).Select(p => p.Key);
HashSet
HashSet<Coordinate> cords = new HashSet<Coordinate>();
cords.Add(new Coordinate() { X = 10, Y = 20 });