Call a method using the name of the method. - CSharp Custom Type

CSharp examples for Custom Type:Method

Description

Call a method using the name of the method.

Demo Code

using System;//w w w  .j  a  v a 2 s .c o  m
class NumberManipulator {
   public int FindMax(int num1, int num2) {
      int result;
      if (num1 > num2)
         result = num1;
      else
         result = num2;
      return result;
   }
   static void Main(string[] args) {
         int a = 100;
         int b = 200;
         int ret;
         NumberManipulator n = new NumberManipulator();
         //calling the FindMax method
         ret = n.FindMax(a, b);
         Console.WriteLine("Max value is : {0}", ret );
   }
}

Result


Related Tutorials