using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MemoryTest2 { struct S1 { public int x; public int y; } struct S2 { public S1 A; public S1 B; } class C1 { public S1 A; public S1 B; } class Program { static void increment1(C1 c) { c.A.x++; c.A.y++; } static void increment2(S1 s) { s.x++; s.y++; } static void Main(string[] args) { C1 class1 = new C1(); S1 struct1 = new S1(); S2 struct2 = new S2(); // Examine class1, struct1, struct2 in watch // (paying attention to addresses of each using & operator) increment1(class1); increment2(class1.A); // Examine class1 in watch // what changed, and why } } }