0

Like i heard that string is immutable mean cannot be changed once created so i tried:

String name = "Hunain";
Console.Write("String_replaced="+  name.Replace('i', 'y') + "\n");

according to someone, string.Replace('','') throws a new object and doesn't modify existing string but it did like in above example, neither i stored it in another object nothing, why ? then what's the difference between string type and string builder ?

2
Contributors
1
Reply
14
Views
4 Years
Discussion Span
Last Post by Nguyễn Đình Đại
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.