error in C# code
Posted
by user318068
on Stack Overflow
See other posts from Stack Overflow
or by user318068
Published on 2010-06-02T19:10:40Z
Indexed on
2010/06/02
19:14 UTC
Read the original article
Hit count: 288
hi all .
I have a problem with my code in C# . if i click in compiler button , I get the following errors
'System.Collections.Generic.LinkedList' does not contain a definition for 'removeFirst' and no extension method 'removeFirst' accepting a first argument of type 'System.Collections.Generic.LinkedList' could be found (are you missing a using directive or an assembly reference?).
and
'System.Collections.Generic.LinkedList' does not contain a definition for 'addLast' and no extension method 'addLast' accepting a first argument of type 'System.Collections.Generic.LinkedList' could be found (are you missing a using directive or an assembly reference?)
This is part of a simple program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Hanoi
{
public class Sol
{
public LinkedList<int?> t1 = new LinkedList<int?>();
public LinkedList<int?> t2 =new LinkedList<int?>();
public LinkedList<int?> t3 =new LinkedList<int?>();
public int depth;
public LinkedList<Sol> neighbors;
public Sol(LinkedList<int?> t1, LinkedList<int?> t2, LinkedList<int?> t3)
{
this.t1 = t1;
this.t2 = t2;
this.t3 = t3;
neighbors = new LinkedList<Sol>();
}
public virtual void getneighbors()
{
Sol temp = this.copy();
Sol neighbor1 = this.copy();
Sol neighbor2 = this.copy();
Sol neighbor3 = this.copy();
Sol neighbor4 = this.copy();
Sol neighbor5 = this.copy();
Sol neighbor6 = this.copy();
if (temp.t1.Count != 0)
{
if (neighbor1.t2.Count != 0)
{
if (neighbor1.t1.First.Value < neighbor1.t2.First.Value)
{
neighbor1.t2.AddFirst(neighbor1.t1.RemoveFirst());
neighbors.AddLast(neighbor1);
}
}
else
{
neighbor1.t2.AddFirst(neighbor1.t1.RemoveFirst());
neighbors.AddLast(neighbor1);
}
if (neighbor2.t3.Count != 0)
{
if (neighbor2.t1.First.Value < neighbor2.t3.First.Value)
{
neighbor2.t3.AddFirst(neighbor2.t1.RemoveFirst());
neighbors.AddLast(neighbor2);
}
}
else
I hope that you find someone to help me
© Stack Overflow or respective owner