I am using following code for getting first element of linkedlist worklist but i am getting error on line 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;
according to definition of .First the above code should work. Please help me with this problem.
The definition of class Edge is given below
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;
}
}
Use this:
worklist.Firstreturns aLinkedListNode<Edge<T>>. You need to access the value of this first node in order to get anEdge<T>.