namespace Test { class Program { static void Main(string[] args) { A a = new A(); a.MyString = "Metallica "; PrintA(a); Console.WriteLine(a.MyString); string name = "Linkin "; Print(name); Console.WriteLine(name); Console.ReadLine(); } static void PrintA(A a) { a.MyString = a.MyString + "Rocks"; Console.WriteLine(a.MyString); } static void Print(string text) { text = text + "Park"; Console.WriteLine(text); } } class A { public string MyString { get; set; } } } Output:
Metallica Rocks
Metallica Rocks
Linkin Park
Linkin
My question here is that, if string is a reference type (i.e. a class) then why does it not change value of the variable name after the method Print() is called, like it happens for reference variable a's member MyString.