albert albert

albert albert

  • NA
  • 524
  • 0

Linked List problem

Nov 1 2011 6:44 PM
Hi Everyone,

I have this:

[code]
 private static void createRandomChar<E>(LinkedList<E>list1)
        {
          
           //LinkedList<char> list1 = new LinkedList<char>();
          //  LinkedList<char> list2 = new LinkedList<char>();

            //list = random.Next(0, 26);
            for (int i = 0; i < 10; i++)
            {
                int nextInt = random.Next(0, 26);
                var let = ('a' + nextInt);
                //list.AddLast(nextInt); 
                list1.AddLast(let);               
                Console.Write(list1.Last() + " ");
               
            }                  
 
        }
[/code]

But I get the error:
cannot convert from 'char' to 'System.Collections.Generic.LinkedListNode<E>'

By this line:  list1.AddLast(let); 

THX for helping.


Answers (4)