Welcome to fuzzydev Sign in | Join | Help
in Search

.Net

Interned string

Interned string is nothing but a locked up version of a string, so that it can be shared.

Memory allocation can be avoided by using string.Empty.

string sFirstName = string.Empty;

The C# compiler is intelligent enough to generate code based on our declaration, if we declare a string object with either string.Empty it just refers to a shared empty string object. As we know string object are immutable(cannot be changed) once created so any assignment will not affect the shared string object.

Published 09 June 2006 by sachinjoshi
Filed Under:
New Comments to this post are disabled

This Blog

Post Calendar

<June 2006>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

Sponsored Links

Syndication

Copyright 2006, Sachin Joshi. All rights reserved.
The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.
Powered by Community Server, by Telligent Systems