Why string.Replace("X","Y") works only when assigned to new string?
        Posted  
        
            by Petr
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Petr
        
        
        
        Published on 2010-06-01T13:07:16Z
        Indexed on 
            2010/06/01
            13:13 UTC
        
        
        Read the original article
        Hit count: 190
        
c#
|string-manipulation
Hi,
I guess it has to do something with string being a reference type but I dont get why simply string.Replace("X","Y") does not work?
Why I need to do `string A=stringB.Replace("X","Y")
I thought it is just a method to be done on specified instance? Thanks for explanation
EDIT: Thank you so far. I extend my question> Why "b+="FFF"works but the b.replace is not?
© Stack Overflow or respective owner