</>
Skip to content
C# lessons (30/34)

C# — Delegates

Basic delegate

delegate void MyDelegate(string message);

MyDelegate del = (msg) => Console.WriteLine(msg);
del("Hello");

Func/Action

Func<int, int, int> add = (a, b) => a + b;
Action<string> print = (msg) => Console.WriteLine(msg);

Mini Practice

  1. Create delegate
  2. Use Func/Action
  3. Pass delegate as parameter
  4. Practice callbacks

Up Next

Continue with File I/O - File operations.

Related Topics

Frequently Asked Questions about Delegates

What is Delegates in C#?

Delegates is a fundamental concept in C#. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Delegates?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Delegates.

Why is Delegates important in C#?

Delegates is essential for C# development. Understanding this concept will help you write better code and solve real-world problems more effectively.