Essentially yes.  In practical terms, never do string concatenation on
an object, especially if it is being done repeatedly.

E.g. this is VERY bad:

Int32 i = 0;
String test = "";
while (i < 100)
{
 test += i.ToString();
 i++;
}

whereas this is much better:

Int32 i = 0;
StringBuilder test = new StringBuilder();
while (i < 100)
{
 test.Append(i.ToString());
 i++;
}


On 2 Oct, 21:18, altja <[EMAIL PROTECTED]> wrote:
> So the String class is immutable compared to the rest of the reference
> types.
>
> Immutable = any change to the object causes the runtime to create a
> new one and abandon the old one.
>
> So does this mean that String always trashes its object while any
> other reference type just adds an additional pointer to the memory
> location.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment

You may subscribe to group Feeds using a RSS Feed Reader to stay upto date 
using following url  

<a href="http://feeds.feedburner.com/DotNetDevelopment";> 
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---

Reply via email to