Skip to content
Justice Tech School

Method Overloading

Several methods may share a name with different parameters.

Example
static string Show(int x) => "int " + x;
static string Show(string x) => "string " + x;
static string Show(double x) => "double " + x;
Console.WriteLine(Show(1));
Console.WriteLine(Show("a"));
Console.WriteLine(Show(1.5));

Exercise

Overloads differ by.

Different 

Quiz Test

Can return type alone overload?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.