---
title: "What is method overloading in C#? Give an example."  
description: "What is method overloading in C#? Give an example."  
author: "Steilla Mitchel"  
published: 2021-11-17  
updated: 2021-11-17  
canonical: https://www.mindstick.com/forum/156845/what-is-method-overloading-in-c-sharp-give-an-example  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# What is method overloading in C#? Give an example.

What is [method overloading](https://www.mindstick.com/forum/127/method-overloading) in C#? Give an example.

## Replies

### Reply by Ashutosh Kumar Verma

## [Method](https://www.mindstick.com/forum/166/webservice-method) Overloading in C#:

Method overloading is process in which it allow the programmer to use multiple methods with the same name in same class. But the methods are differentiate with their number and type of argument that passed in methods. Method overloading is a example of Polymorphism of object oriented programming language.

**Method overloading can be used with the following point.**

• Different number of parameter of methods .

• Different data type of parameter passed in method.

• Different sequence of parameter that passed in method.

**Example**:

```
using System;
public class Program
{
 public static void Main()
 {
   MethodOveloadingExample m=new MethodOveloadingExample();
  Console.WriteLine( m.sum(1,2,5));
   }
 public class MethodOveloadingExample
  {
  public int sum(int a, int b)  //two int type Parameters method
   {
    return a+b;
   }
   public int sum(int a, int b,int c)  //three int type Parameters with same method same as above
   {
  return a+b+c;
                   }
   public float sum(float a, float b)
   {
   return a+b;
   }
  }
}
```

OUTPUT:

8

\


---

Original Source: https://www.mindstick.com/forum/156845/what-is-method-overloading-in-c-sharp-give-an-example

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
