This time, we will need to implement a different BuildPath function, in case you have followed along with the previous path-finding recipes. Otherwise, we will need to implement this method, which we haven't defined yet:
private List<Vertex> BuildPath(Vertex v) { List<Vertex> path = new List<Vertex>(); while (!ReferenceEquals(v, null)) { path.Add(v); v = v.prev; } return path; }