I am passing lot of XML Parameters from my application to the SQL Server (both windows and ASP.Net application)
Earlier i used to build XML using the based concatenation operator in string, similar to the one below.
string XmlDetails = string.Empty;
XmlDetails = "<APPLICATION><SEND>";
XmlDetails += "<ID>" + txtCardNo.Text.ToString() + "</ID>";
XmlDetails += "</SEND></APPLICATION>";
The application really used to hog memory and was really slow. I changes the concatenation method to String Builder class to build big XML.
XmlDetails = string.Format("{0}<{1}>{2}</{1}>", "<APPLICATION><SEND>", "ID", txtCardNo.Text.ToString());
XmlDetails = string.Format("{0}<{1}>{2}</{1}>{3}", XmlDetails, "PAYDET", txtPOSPaydet.Text.ToString(), "</SEND></APPLICATION>");
While using the above method there was a drastic change in the memory levels used by my application.
I would like to know if there are any better methods which could be employed in my application.