I’m using this line of code to insert a value from an array into a certain line, in a list of lines.
lineList[LineNumber].Insert(lineList[LineNumber].Count(), pArray[i]);
After debugging all the variables are correct, the pArray is passed in as a parameter and lineList is inherited from another class. I can’t see why this wouldnt work, all the lines that are added are just empty?
This is because .NET strings are immutable;
string.Insertreturns a new string, rather than modifying an existing one. If you need to modify the string, add an assignment, like this:This should be equivalent to