I have a method that needs to return List<'MyClass>[] and need to set up a local variable to do so, but am having trouble with initialization.
I tried:
List<MyClass>[] lists = new List<MyClass>[5];
Which gave me an error of "Cannot create a generic array of List"
I tried casting an array of Objects:
List<MyClass>[] lists = (List<MyClass>[]) new Object[5];
Which gave me a casting error in runtime.
I also tried:
List<MyClass>[] lists = (List<MyClass>[]) new List[5];
Which resulted in a null pointer exception.
Anyone know what needs to be done to get this to work?
Thanks.