N
Nicholas Paldino [.NET/C# MVP]
Steph,
The Insert method does not change the string it is called on. Strings
are immutable. Rather, it returns a new string that has the inserted text.
All methods that perform operations on strings work in this manner.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hi,
String.Insert doesn't seems to work.... (see example below)
Could someone explain me this ? :
private void button1_Click(object sender, System.EventArgs e)
{
string tmp="12345678901234567890";
string toinsert="HELLO";
tmp.Insert(10,toinsert);
MessageBox.Show(tmp);
}
And the message box show : 12345678901234567890 instead of
1234567890HELLO1234567890
Thanks for Help,
steph.
The Insert method does not change the string it is called on. Strings
are immutable. Rather, it returns a new string that has the inserted text.
All methods that perform operations on strings work in this manner.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Hi,
String.Insert doesn't seems to work.... (see example below)
Could someone explain me this ? :
private void button1_Click(object sender, System.EventArgs e)
{
string tmp="12345678901234567890";
string toinsert="HELLO";
tmp.Insert(10,toinsert);
MessageBox.Show(tmp);
}
And the message box show : 12345678901234567890 instead of
1234567890HELLO1234567890
Thanks for Help,
steph.