Reputation: 3
tryin to implement stack with linked list, have trouble in pop, the code
public class MyItemType
{
................
}
class MyStack
{
LinkedList<MyItemType> ourList = null;
MyItemType top = null;
................
public MyItemType Pop()
{
if (IsEmpty())
{
return null;
}
else
{
MyItemType temp = ourList.Last; // <--- issue here
ourList.RemoveLast();
return temp;
}
}
................
}
error: Error 2 Cannot implicitly convert type 'System.Collections.Generic.LinkedListNode' to 'Ex1.MyItemType'
Upvotes: 0
Views: 608