Besides that...StringBuilder is really only faster when building strings from a few hundred properties, or from a few hundred different objects. It's overrated, really.
On Wed, Feb 4, 2009 at 2:42 PM, jay <[email protected]> wrote: > > I wrote the function to be a replacement for doing something like > this: > > string myString = "example" + "example" + "example" + "example" + > "example" + "example"; > > So instead you do this: > > string myString = JoinArgs("example", "example", "example", "example", > "example", "example" ); > > > ..which I assume is faster since strings are immutable. > > > On Jan 30, 1:08 am, Cerebrus <[email protected]> wrote: > > Strings are immutable, the StringBuilder is mutable. The latter does > > not use Strings internally. > > > > On Jan 30, 12:35 am, jay <[email protected]> wrote: > > > > > > > > > Does StringBuilder already do something like this? Or is what I have > > > here good? > > > > > protected string JoinArgs( params string[] args ) > > > { > > > return String.Join( "", args ); > > > > > }- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - >
