Back to course

Method Overloading

C# Zero to Hero: Comprehensive Programming Masterclass

Overloading Methods

Method overloading allows multiple methods to have the same name with different parameters.

Example

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

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

C# knows which one to call based on the data types of the arguments you pass.