Like other Programming languages C# also supports method overloading. Method overloading is a feature found in various programming languages such as Ada, C#, C++, D and Java that allows the creation of several methods with the same name which differ from each other in terms of the type of the input and the type of the output of the function. [According to wikipedia]

Method Overloading Example

Suppose in our application we want to add to two integers, double, float and long. The first way is to create unique methods for each addition operation or call a single method name with distinct set of arguments.

The Visual Studio IDE will provide you assistance while calling overloaded method.

method overloading

Code Snippet
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Method_Overloading
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             Console.WriteLine("**********************************Method Overloading Demo**********************************");
  13.             Console.WriteLine("Add two int :" + Add(1, 1));
  14.             Console.WriteLine("Add two Double :" + Add(1.0, 1.0));
  15.             Console.WriteLine("Add two float :" + Add(11.12, 1.123));
  16.             Console.WriteLine("Add two long :" + Add(234561, 11235678));
  17.             Console.ReadLine();
  18.  
  19.         }
  20.         private static  Int64 Add(int num1, int num2)
  21.         {
  22.             return num1 + num2;
  23.         }
  24.         private static double Add(double num1, double num2)
  25.         {
  26.             return num1 + num2;
  27.         }
  28.         private static float Add(float num1, float num2)
  29.         {
  30.             return num1 + num2;
  31.         }
  32.         private static long Add(long num1, long num2)
  33.         {
  34.             return num1 + num2;
  35.         }
  36.     }
  37. }

Method overloading does not depends upon the return type of method, if you are having two methods with unique name with equal number of arguments and of same type with different return type than these methods are not overloaded method instead they are same methods and compiler will give error at compile time.

method overloading error