Register to Better Coder! It's free.
Enjoy the premium features and succeed at every job interview.

What must every method have in C#?

Experience Level: Junior
Tags: C#

Answer

Every method in C# must have two parts:

  • Method signature
  • Method body

Method signature must have four parts:

  • Access modifier
  • Return data type
  • Name
  • Parameters (parameters are wrapped in rounded brackets and are delimited by comma)

Method body is wrapped in curly brackets.

Comments

No Comments Yet.
Be the first to tell us what you think.
C# for beginners
C# for beginners

Are you learning C# ? Try our test we designed to help you progress faster.

Test yourself