Interviews24 answers
Is string mutable or immutable?
24 Answers
strings are always imutable
Abhishek KumarPosted Feb 3, 2016, 10:01 PM EST
Immutable
Joe WilsonPosted Dec 24, 2015, 7:43 AM EST
String objects are NOT ALWAYS immutable. Ignore all posts in this thread that spread this misconception.
Below for example I show an example where I take "thequickbrownfox" and change each character in turn into "THEQUICKBROWNFOX" The original string is mutable in this example.
String s = "thequickbrownfox";
Console.WriteLine(s);
unsafe
{
fixed (char* ca = s)
for (char* c = ca; *c != 0; c++)
*c = char.ToUpper(*c);
}
Console.WriteLine(s);
Michael O'sheaPosted Jun 20, 2015, 9:40 AM EDT
Strings are always immutable
Safayat ZisanPosted Apr 22, 2015, 10:28 AM EDT
Immutable string can’t be alter, once we have assign a value to immutable object state can’t be changed
We can assign multiple values to mutable string and object state can be altered.
Posted Apr 14, 2015, 1:44 AM EDT
string objects are always immutable
sajidlkhan lodiPosted Feb 9, 2015, 1:07 AM EST
string iobjects are always immutable
sajidlkhan lodiPosted Feb 9, 2015, 1:07 AM EST
string iobjects are always immutable
sajidlkhan lodiPosted Feb 9, 2015, 1:07 AM EST
string iobjects are always immutable
sajidlkhan lodiPosted Feb 9, 2015, 1:07 AM EST
string is immutable , can not change value
Ravi PrajapatiPosted Dec 15, 2014, 8:57 PM EST
string is immutable , can not change value
Ravi PrajapatiPosted Dec 15, 2014, 8:55 PM EST
immutable
Gokul RathodPosted Nov 25, 2014, 3:01 AM EST
Yes String are immutable.
Dhanik SahniPosted Oct 9, 2014, 5:38 AM EDT
system.string is immutable
Munesh SharmaPosted Oct 9, 2014, 1:08 AM EDT
Yes String are immutable.
Akhil GargPosted Sep 14, 2014, 8:39 AM EDT
Immutable,so that they are used for smaller operation
Sunil GadedPosted Aug 28, 2014, 2:06 AM EDT
All strings are immutable.because if you try to insert a value more than once it will replace previous value.String Builders are mutable.
venky prasadPosted Aug 26, 2014, 5:25 AM EDT
Yes string is a immutable
varunkumar reddyPosted Aug 23, 2014, 4:20 AM EDT
Immutable means string values cannot be changed once they have been created. Any modification to a string value results in a completely new string instance, thus an inefficient use of memory and extraneous garbage collection. The mutable System.Text.StringBuilder class should be used when string values will change.
Najna AbdullaPosted Aug 20, 2014, 12:39 AM EDT
The main difference is system.string is immutable and system.stringbuilder is a mutable. Append keyword is used in string builder but not in system.string.
Immutable means once we created we cannot modified. Suppose if we want give new value to old value simply it will discarded the old value and it will create new instance in memory to hold the new value.
Ankur JainPosted Aug 18, 2014, 4:35 AM EDT
mutable
Payal SharmaPosted Aug 11, 2014, 4:06 AM EDT
String is Immutable, They cannot be altered
shashi pPosted Aug 7, 2014, 8:47 AM EDT
All string objects are immutable in C#.
manikumar madduPosted Aug 4, 2014, 11:11 PM EDT
mutable means "changeable" and immutable is acronym of that.
strings are immutable.
Guest UserPosted Aug 1, 2014, 7:01 PM EDT









