I have this routine which alters all elements within an array...
for (int i = 0; i < sOutputFields.GetUpperBound(0); i ++)
{
sOutputFields[i] = clsSQLInterface.escapeIncoming(sOutputFields[i]);
}
sOutputFields is a one dimensional string array. escapeIncoming() is a function which returns a string.
I thought this could be re-written thus..
sOutputFields.Select(el => clsSQLInterface.escapeIncoming(el));
..but this appears to do nothing (though does not throw an exception). So I tried..
sOutputFields =
(string[])sOutputFields.Select(el => clsSQLInterface.escapeIncoming(el));
..but I get this exception at execution time..
"Unable to cast object of type 'WhereSelectArrayIterator`2[System.String,System.String]' to type 'System.String[]'."
how to fix?