private void UpdateNeighbors(GridNode <T, U> node) { Dictionary <GridDirection, GridNode <T, U> > neighbors = GetNeighbors(node); foreach (KeyValuePair <GridDirection, GridNode <T, U> > entry in neighbors) { GridDirection direction = entry.Key; GridNode <T, U> neighbor = entry.Value; node.Neighbors[direction] = neighbor; neighbor.Neighbors[direction.Reverse()] = node; } }