Understanding Strings in C#(sanjevsharma.blogspot.com)

submitted by sanjev.sharmasanjev.sharma(579) 4 years, 10 months ago

Strings are immutable, which means that they cannot be changed in memory. So if we append something to a string, the .Net Framework will actually reserve memory for a new string of the total desired length and then copy the original string and the new string into it. So long as the original strings are still reference, they will not be garbage-collected. We never think of this while appending to a string!!

1 comment |category: |Views: 3

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 10 months ago 0

Most of us think ourselves into premature optimization over it. Worrying about strings is the biggest bugaboo of .NET developers. Unless its causing you performance issues (a remote possibility), forget about it.

Reply

information Login or create an account to comment on this story