Hi
string is reference type, so why do i get this with the code below: Joe Joe Bill, Joe?
I would expect Joe Joe Bill, Bill because string is not a value variable.
Thanks again
string str = "Joe";
string str2 = str;
Console.WriteLine(str);
Console.WriteLine(str2);
str = "Bill";
Console.WriteLine(str);
Console.WriteLine(str2);

Rajeev KumarRank #1,334 · 1.3K reputationPosted Mar 14, 2023, 6:22 AM EDT
String value can not be changed Because it is Refrence Type and a string is immutable each and every time it store a new addres for memory Location.
Satya KarkiRank #78 · 24.6K reputationPosted Jun 22, 2021, 1:23 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 22, 2021, 7:22 AM EDT
Valerie MeunierRank #1,527 · 1K reputationPosted Jun 22, 2021, 8:57 AM EDT