Nested methods : Member Method « Class « C# / CSharp Tutorial






using System;

class MainClass
{
   static void MethodA(int par1, int par2)
   {
      Console.WriteLine("Enter MethodA: {0}, {1}", par1, par2);
      MethodB(11, 18);
      Console.WriteLine("Exit MethodA");
   }

   static void MethodB(int par1, int par2)
   {
      Console.WriteLine("Enter MethodB: {0}, {1}", par1, par2);
      Console.WriteLine("Exit MethodB");
   }

   static void Main()
   {
      MethodA(15, 30);
   }
}
Enter MethodA: 15, 30
Enter MethodB: 11, 18
Exit MethodB
Exit MethodA








7.4.Member Method
7.4.1.Define methods
7.4.2.Member Functions
7.4.3.Nested methods
7.4.4.Return a value from a member method
7.4.5.Define Rectangle class with method to compute the area
7.4.6.Object Class Methods