Click here to Skip to main content
16,004,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: string problem...! Pin
Utku KAYA14-Nov-04 2:36
Utku KAYA14-Nov-04 2:36 
Questionpass name of the property & get value ? Pin
Utku KAYA13-Nov-04 20:21
Utku KAYA13-Nov-04 20:21 
AnswerRe: pass name of the property & get value ? Pin
rudy.net14-Nov-04 6:11
rudy.net14-Nov-04 6:11 
Generalhelp with textbox Pin
tom_dx13-Nov-04 16:48
tom_dx13-Nov-04 16:48 
GeneralRe: help with textbox Pin
Charlie Williams13-Nov-04 19:25
Charlie Williams13-Nov-04 19:25 
GeneralRe: help with textbox Pin
tom_dx14-Nov-04 4:09
tom_dx14-Nov-04 4:09 
GeneralRe: help with textbox Pin
tom_dx14-Nov-04 4:44
tom_dx14-Nov-04 4:44 
GeneralRe: help with textbox Pin
Charlie Williams14-Nov-04 7:34
Charlie Williams14-Nov-04 7:34 
It's not a bug. Strings in .NET are immutable, which means they cannot be changed once they are initialized. Calling Insert or Remove on a string does not change the object on which the method was called; It returns a new string with the new value.
string s1  = "This is a string.";
string s2 = s1.Insert(10, "new ");
 
// s1 is still "This is a string."
Console.WriteLine(s1);
 
// "This is a new string."
Console.WriteLine(s2);

If you do want to change the string that s1 references, you'd assign the return value from the method you're calling to it.
string s1 = "This is a string.";
s1 = s1.Insert(10, "new ");
 
// "This is a new string."
Console.WriteLine(s1);



Charlie

if(!curlies){ return; }
GeneralRe: help with textbox Pin
tom_dx14-Nov-04 8:18
tom_dx14-Nov-04 8:18 
Generalc programming exercise Pin
edison_jan200413-Nov-04 14:11
edison_jan200413-Nov-04 14:11 
GeneralRe: c programming exercise Pin
Colin Angus Mackay13-Nov-04 14:24
Colin Angus Mackay13-Nov-04 14:24 
GeneralBeginConnect: interrupt or set timeout period Pin
SebbaP13-Nov-04 10:57
SebbaP13-Nov-04 10:57 
GeneralRe: BeginConnect: interrupt or set timeout period Pin
leppie14-Nov-04 10:52
leppie14-Nov-04 10:52 
GeneralStructure Pin
StephenMcAllister13-Nov-04 10:08
StephenMcAllister13-Nov-04 10:08 
GeneralRe: Structure Pin
MoustafaS13-Nov-04 13:59
MoustafaS13-Nov-04 13:59 
GeneralGet value using the name of property Pin
Utku KAYA13-Nov-04 8:13
Utku KAYA13-Nov-04 8:13 
GeneralRe: Get value using the name of property Pin
Wizard_0114-Nov-04 1:33
Wizard_0114-Nov-04 1:33 
GeneralRe: Get value using the name of property Pin
Utku KAYA14-Nov-04 4:24
Utku KAYA14-Nov-04 4:24 
Generaldisplay phone caller number Pin
Anonymous13-Nov-04 6:55
Anonymous13-Nov-04 6:55 
GeneralRe: display phone caller number Pin
tom_dx13-Nov-04 8:22
tom_dx13-Nov-04 8:22 
GeneralRe: display phone caller number Pin
Anonymous13-Nov-04 8:35
Anonymous13-Nov-04 8:35 
GeneralRe: display phone caller number Pin
tom_dx13-Nov-04 9:02
tom_dx13-Nov-04 9:02 
GeneralRe: display phone caller number Pin
Michael P Butler13-Nov-04 9:34
Michael P Butler13-Nov-04 9:34 
Generalreferencing a containerframe Pin
stefan houtz13-Nov-04 6:23
stefan houtz13-Nov-04 6:23 
GeneralRe: referencing a containerframe Pin
Skynyrd13-Nov-04 7:35
Skynyrd13-Nov-04 7:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.