Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
Phagu Mahato
More...
Forums
»
.NET
»
.NET
»
What is mutable and immutable?
Posted Date:
24 Dec 2007
Posted By::
venkat
Member Level:
Gold
Member Rank:
0
Points
: 2
Responses:
5
What is mutable and immutable?
Tweet
Responses
#172436 Author:
Satish Kumar J
Member Level:
Gold
Member Rank:
30
Date: 24/Dec/2007 Rating:
Points
: 2
String is immutable
i.e. Strings cannot be altered. When you alter a string (by adding to it for example), you are actually creating a new string.
But StringBuilder is not immutable
so if u have to alter a string many times, such as mutliple concatenations then use StringBuilder.
more info
http://www.dotnetspider.com/qa/Question57725.aspx
Regards,
Satish,
Regards,
Satish
My Blog
#172437 Author:
Vadivel Mohanakrishnan
Member Level:
Gold
Member Rank:
27
Date: 24/Dec/2007 Rating:
Points
: 2
An object qualifies as being called immutable if its value cannot be modified once it has been created. For example, methods that appear to modify a String actually return a new String containing the modification. Developers are modifying strings all the time in their code. This may appear to the developer as mutable - but it is not. What actually happens is your string variable/object has been changed to reference a new string value containing the results of your new string value. For this very reason .NET has the System.Text.StringBuilder class. If you find it necessary to modify the actual contents of a string-like object heavily, such as in a for or foreach loop, use the System.Text.StringBuilder class.
Source:: http://blogs.crsw.com/mark/archive/2004/08/06/449.aspx
Best Regards
Vadivel
MVP SQL Server
SQL Server Tips n Tricks
#172579 Author:
kumar
Member Level:
Gold
Member Rank:
156
Date: 25/Dec/2007 Rating:
Points
: 2
Hi,
immutable means data value may not be changed but mutable means data value will be changed.
thanks and regards,
kumar
#278671 Author:
asdf
Member Level:
Silver
Member Rank:
0
Date: 08/Aug/2008 Rating:
Points
: 0
• Mutable & Immutable
System.StringBuilder is mutable where variety of operations can be performed
System.String is immutable variable value may change BUT original data value will be discarded and new value will be in memory.
#304413 Author:
pandikumar
Member Level:
Bronze
Member Rank:
0
Date: 07/Oct/2008 Rating:
Points
: 1
Simply says
Mutable is liable to change
Immutable is not liable to change...
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
master page
Previous :
Can we inherit a COM boject in .net ?
Return to Discussion Forum
Post New Message
Category:
Related Messages
Is there any expert to solve this?
what is difference between String and string(data type) in c#?
what is a resource file...
Horizontal Scroll Bar for a listview control
sql querry
Follow us on Twitter:
https://twitter.com/dotnetspider
Active Members
Today
Pawan Awasthi
(68)
Phagu Mahato
(10)
Raj.Trivedi
(9)
Last 7 Days
baskar
(298)
Pawan Awasthi
(178)
Asheej T K
(173)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds