CSharp examples for Custom Type:Method
Square method used to demonstrate the method call stack and activation records.
using System;//from w w w .j a v a 2s. co m class SquareTest { static void Main() { int x = 10; // value to square (local variable in main) Console.WriteLine($"x squared: {Square(x)}"); } static int Square(int y) // y is a local variable { return y * y; // calculate square of y and return result } }