I need to make array in a arraylist or in a list, I used this:
List<string[]> OL = new List<string[]>();
string[] OLdata = new string[7];
OLdata[0] = .. ; OLdata[1] = .. OLdata[6] = ..
OL.Add(OLdata);
and I can access it with
OL[0].GetValue(3) or OL[0][3] ..
again writing to OLdata and adding it in OL list, when I try to access data with
OL[0][3] ..
I am getting the new data which was inserted in array, I am obviously expecting different values in OL[0][3] and OL[1][3] , whats the reason or any other suggestion ??
Addstatement I'd say accessingOL[1][3]this way should throw an exception. If you've just added OLdata twice, then I would have to +1 @LukeH's answer.OL[0] = ..; OL[1] = ...should beOLdata[0] = ...; OLdata[1] = ...