StringBuilder vs. String.Concat
Hello Varese,
The String is faster, however it needs more memory. Since it need create a
new object each time you modify it. On the other hand, the StringBuilder
needs less memory but more time. In general, it is suggested to use String
class if you don't modify the string very frequently or the string is not
very long. However, if you want a mutable sequence of characters (such as
for Interop with unmanaged code), the StringBuilder is necessary.
I hope this information is helpful.
Best regards,
Lion Shi, MCSE, MCSD
Microsoft Support Engineer
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. 2001 Microsoft Corporation. All rights
reserved.
--------------------
Newsgroups: microsoft.public.dotnet.languages.CSharp
Subject: StringBuilder vs. String.Concat
Date: 5 Jun 2002 02:11:35 -0700
Organization: http://groups.google.com/
Lines: 13
NNTP-Posting-Host: 194.185.48.6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1023268295 24941 127.0.0.1 (5 Jun 2002
09:11:35 GMT)
NNTP-Posting-Date: 5 Jun 2002 09:11:35 GMT
Path:
cpmsftngxa08!tkmsftngp01!newsfeed00.sul.t-online.de!t-online.de!news-spur1.m
axwell.syr.edu!news.maxwell.syr.edu!netnews.com!isdnet!sn-xit-02!supernews.c
om!postnews1.google.com!not-for-mail
Xref: cpmsftngxa08 microsoft.public.dotnet.languages.csharp:65706
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
Hello, I cannot understand which method is more efficient (considering
memory usage and speed):
a) string s = String.Concat ("Kkkk","lll","lll",...)
or
b) string s = Stringbuilder.Append ("..")..
Thank you for help
Simone,
Varese - ITALY