i have some letters in my config with x y coordinates. i want to add key + x + y to my dictionary, but i dont get it work...
example config:
c|1807|833
Code:
private Dictionary<char, Tuple<int, int>> keyCoords;
...
string[] lines = File.ReadAllLines(filePath);
foreach (string line in lines)
{
string[] parts = line.Split('|');
if (parts.Length != 3)
{
continue;
}
char key = parts[0][0];
int x = int.Parse(parts[1]);
int y = int.Parse(parts[2]);
keyCoords[key] = Tuple.Create(x, y);
}
The last line keyCoords[key] = Tuple.Create(x, y);
gives me a error:
The object reference was not set to an object instance.