[C# .Net 2.0] List<type>

Associate
Joined
1 Feb 2006
Posts
1,868
Location
Reading
I've just started using generic List<t>'s and have come across some problems.

Before with an array of structs i could directly modify it's members e.g.:

Code:
Public struct test
{
      string str;
      int i;
}

Public void main()
{
test[] aArray = new test[5];
aArray.str = "Hello World";
}
But when i try with a List<T> i get Compiler Error CS1612 "Cannot modify the return value of 'expression' because it is not a variable"

And secondly if i try to pass an element of a generic list as a ref parameter i get Compiler Error CS0206 "A property or indexer may not be passed as an out or ref parameter"

Thanks for any help.
 
Back
Top Bottom