I have the following for a position class:
public struct Pos
{
public int x;
public int y;
public float height;
public Pos (int _x, int _y, float _height)
{
x = _x;
y = _y;
height = _height;
}
public override string ToString ()
{
return x.ToString() + "," + y.ToString();
}
}
But since I am calling Pos.ToString()
thousands of times, this is too slow for me. All I need is an efficient way to get a single unique value based on Pos.x
and Pos.y
, for use as a dictionary key.
Note: I cannot use Pos
because I am comparing different instances of Pos
on merely x
and y
.