← Back to C# Course | Chapter 5: Methods | Lesson 1 of 6

Method Basics

In this page:

  1. Method Basics

Method Basics

A method is a named, reusable block of code declared with a return type, a name, and a parameter list. Calling a method transfers control to its body and resumes the caller once it returns. Breaking logic into methods keeps programs organized and avoids repeating code.

Note: Method names conventionally use PascalCase in C#, like CalculateTotal.

Example: Method Basics

markup
using System;

class Program
{
    static void PrintBanner()
    {
        Console.WriteLine("=== Welcome ===");
    }

    static void Main(string[] args)
    {
        PrintBanner();
        Console.WriteLine("Program running");
    }
}
🔒

Chapter Quiz — Complete all 6 topics to unlock

0/6 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.