Reference Types
Reference types store a reference to the data on the heap. Assignment copies the reference, not the data.
class Person { public string Name; }Person p1 = new Person();p1.Name = "Alice";Person p2 = p1; // p2 references same objectp2.Name = "Bob";Console.WriteLine(p1.Name); // BobRun the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”Bob