我正在使用以下代码获取链表工作列表的第一个元素,但在第 2 行出现错误
Cannot implicitly convert type System.Collections.Generic.LinkedListNode<Edge<T>>' to 'Edge<T>'
LinkedList<Edge<T>> worklist = new LinkedList<Edge<T>>();
Edge<T> curr = worklist.First;
根据 .First 的定义,上面的代码应该可以工作。请帮我解决这个问题。
Edge 类的定义如下
private sealed class Edge<T>
{
public T start;
public T end;
/// <summary>
/// Constructs a new edge between the two indicated endpoints.
/// </summary>
/// <param name="start"> The edge's starting point. </param>
/// <param name="end"> The edge's endpoint. </param>
public Edge(T start, T end)
{
this.start = start;
this.end = end;
}
}