static void Main(string[] args) { /**********Structure**********/ PointS one1 = new PointS(12, 8); PointS two = Reverse(ref one1); Console.WriteLine($"one.X = {one1.X} one.Y={one1.Y}"); Console.WriteLine($"two.X = {two.X} one.Y={two.Y}"); PointS[] arr = new PointS[50]; Console.WriteLine($"arr[0].X={arr[0].X} arr[0].Y={arr[0].Y} typeof(arr[0])={arr[0].X.GetType()}"); PointS three = new PointS(); three.Y = 2.34; Console.WriteLine($"three.X={three.X} three.Y={three.Y}"); PointS four; four = three; Console.WriteLine($"four.X={four.X} four.Y={four.Y}"); MyObject obj = new MyObject { X = 10, Y = 5 }; Console.WriteLine(obj.ToString()); lesson2.Method1(); }
static PointS Reverse(ref PointS dot) { dot.X = -dot.X; dot.Y = -dot.Y; return(dot); }