4
Answers

Linked List problem

albert albert

albert albert

13y
1.2k
1
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)