Good developers don’t work too hard. We all push ourselves to get better at coding, but when something seems difficult or repetitive, there’s usually a better way to do it!

Methods are a good example:

bool IsEven(int num) { return num % 2 == 0; }

Why bother with these curly braces ({ }) and return keywords for such a short method?

In C# there are other ways to define a method, which can save us effort in typing and make our code easier to read. They’re called expression-bodied definitions and lambda expressions.

From now on, when you see these phrases just think: “These are shortcuts for defining methods!” This lesson will show you how to use them.


Check out these basic method definitions in the text editor. The method signature tells us the types of input to and output from the method. The method body lives inside the curly braces { } and sometimes contains the return keyword.

Take Welcome() for example:

  • The signature tells us that the method takes in a string and outputs nothing.
  • The body prints some text to the console.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?