Re: Generating very large string in C#

Tech-Archive recommends: Fix windows errors by optimizing your registry



Scott M. <s-mar@xxxxxxxxxxxxx> wrote:
Still not a good idea if the string is to be built over several steps,
rather than just one assignment. StringBuilder would be better.

Why? I don't see anything in the OP's original post to indicate that
anything beyond a large string is required. Using that constructor is
the simplest way of generating such a string, IMO. In what way would
StringBuilder be better?

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: when to use StringBuilder
    ... but adding and assigning like shown in the original post will. ... "Steve Willcock" wrote: ... > together you are actually allocating a new string object every time. ... >> via the StringBuilder, when I create an SQLCommand object, I now how to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: StringBuilder Q
    ... instance though instead - if you reuse a StringBuilder a lot, ... reference fields require more complicated operations to keep the GC ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: String.Join vs. StringBuilder, which is faster?
    ... Daniel Billingsley wrote: ... this is a perfect example where StringBuilder at the very best provides ... Let me know where they are and I'll complain about ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: String.Join vs. StringBuilder, which is faster?
    ... Daniel Billingsley wrote: ... this is a perfect example where StringBuilder at the very best provides ... Let me know where they are and I'll complain about ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.framework)
  • Re: when there is stringbuilder, why string ?
    ... > stringbuilder offers more performance, less work for GC and good amount ... Jon Skeet - ... If replying to the group, please do not mail me too ...
    (microsoft.public.dotnet.languages.csharp)