Hire my services

If you would like to hire my services, you can now do so by visiting the following link:

Website Design Darlington

Article Statistics

ArticlesLatest Entry
2121-May-2008

Code Bank Statistics

CategoryTipsLatest Entry
Applications420-Feb-2008
Cache118-Apr-2007
Controls926-Jul-2007
CSS107-Sep-2007
Database428-Aug-2007
Dates128-Aug-2007
Email105-Mar-2007
Files123-Apr-2007
HTML101-Mar-2007
Images226-Mar-2007
Pages115-Oct-2007
Sessions122-Nov-2007
SQL Server1518-Mar-2008
Strings309-May-2007
Skip Navigation LinksHome > Code Bank > Strings > String Concatenation

String Concatenation

Summary: An example of how strings can be concatenated with the StringBuilder class

If you concatenate a string like this:

then you actually end up with 5 strings in memory rather than just the original one that you created. This obviously isn't very efficient.

Instead, you can use the System.Text.StringBuilder class which is both quicker and uses less memory as only one object is created: