public void Move(MethodDemo newmethodDemo) { if (newmethodDemo == null) { throw new ArgumentNullException("newmethodDemo"); } else { Move(newmethodDemo.x, newmethodDemo.y); } }
public static void Method() { //Method Demo and overloading try { var methodDemo = new MethodDemo(10, 20); methodDemo.Move(new MethodDemo(40, 60)); Console.WriteLine("Point is at X: {0} Y:{1}", methodDemo.x, methodDemo.y); methodDemo.Move(400, 800); Console.WriteLine("Point is at X: {0} Y:{1}", methodDemo.x, methodDemo.y); } catch (Exception) { Console.WriteLine("Error Occured"); } }