Back to course

Method Overloading

.NET Zero to Hero: Master C# and Modern App Development

Method Overloading

In C#, multiple methods can have the same name as long as their parameter signatures are different (different number or types of parameters).

Example:

csharp static int PlusMethod(int x, int y) { return x + y; }

static double PlusMethod(double x, double y) { return x + y; }

Instead of creating AddInt and AddDouble, we just use PlusMethod. C# automatically picks the right one based on the arguments you pass.