Remember...string objects are immutable so each time you "change" one, you actually end up creating a new one. Use StringBuilder from the System.Text namespace instead.
J. Keith Wedinger http://bearcatnews.com http://sciotofootball.com -----Original Message----- From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of Greg Gates Sent: Thursday, May 02, 2002 8:24 PM To: [EMAIL PROTECTED] Subject: [DOTNET] String concatenation performance Hello everyone: I have the following helper method to format sql string parameters: public static string DoQuotes(string sqlParam) { if (sqlParam.IndexOf("'") > 0) { sqlParam = sqlParam.Replace("'","''"); } return "'" + sqlParam + "'"; } Is there a better way, performance-wise? thanks, Greg You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.