<aside> Methods are essential building blocks in C# that organize code into reusable, task-specific units. Think of them as specialized functions that can accept inputs (parameters) and return outputs.

</aside>

📚 Understanding Methods

A method is a block of code that performs a specific task. Like a recipe, it takes ingredients (parameters) and produces a result (return value).

🔍 Method Anatomy

public static int CalculateSum(int num1, int num2)
{
    return num1 + num2;
}

🎯 Method Types

1️⃣ Void Methods

public void DisplayMessage(string message)
{
    Console.WriteLine(message);
}  // No return value

2️⃣ Return Methods

public int MultiplyNumbers(int x, int y)
{
    return x * y;
}  // Returns an integer

3️⃣ Static Methods

public static double CalculateArea(double radius)
{
    return Math.PI * radius * radius;
}  // Called without creating an instance

🔐 Access Modifiers

Modifier Access Level
public Accessible everywhere
private Only within same class
protected Class and derived classes
internal Same assembly only - Meaning the entire program can internally access this value but cannot be modified externally
protected internal Protected OR internal access

📝 Method Parameters