Hi All,
I'm getting out of memory exceptions from the following function when RowCollection is 50000+ and thus i need to make it more memory efficient. The function is simply needs to construct a comma separated string of the row indexes stored in RowCollection. Can anyone spot any obvious memory hungry operations in the following?
N.B RowCollection just contains a list of row indexes stored as integers.
Private Function GetCommaSeparatedString(ByRef RowIndexes As ArrayList) As String
Dim RowString As String = String.Empty
'Build a string of the row indexes
'Add one onto each index value so our indexes begin at 1
For Each Row In RowIndexes
RowString += CInt(Row.ToString) + 1 & ","
Next
'Remove the last comma
If RowString.Length > 0 Then
RowString = RowString.Substring(0, RowString.Length - 1)
End If
Return RowString
End Function
Thanks in advance.