static void Returning() { PointS p1 = new PointS { X = 10, Y = 10 }; PointS p2 = new PointS { X = 20, Y = 20 }; Max(ref p1, ref p2).X *= 2; //Console.WriteLine(p1); //Console.WriteLine(p2); Car car = new Car(new Person { Name = "Fred", Licensed = true }); car.Driver = new Person { Name = "Barney", Licensed = false }; Console.WriteLine(car); MyCollection <int> ints = new MyCollection <int>(10); ints[4] = 27; Console.WriteLine(ints[4]); }
static ref PointS Max(ref PointS l, ref PointS r) { if (l.X > r.X) { return(ref l); } else { return(ref r); } }