William Thompson

William Thompson

  • 1.5k
  • 128
  • 292.8k

Declaring an array of linked list in C#

Apr 23 2010 10:09 PM

Declaring an array of linked list in C#
How do I declare an array of some class in C#?  I wonder if it is even allowed or possible.
I got the compile error message "Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)" when I tried to declare an array of linked lists.
public LinkedList<LevelNode>[2] ExistingXMLList;
Also, if I wanted to create a small array of strings, isn't this the way:
string [2] inputdata;

Answers (1)