Bonaventure Systems's Zoom Meeting 5_26_2025, 8_07_25 AM_Page 1-[1748227682502].png

_05 Demo

Example 6: Basic Delegate Usage (_06DemoDelegate)

What it demonstrates:

This example shows the fundamental concept of delegates in C#.

Key Components:

How it works:

  1. Instead of calling Check(20) directly, we create a delegate pointer
  2. The delegate acts as a "function pointer" that can invoke the Check method
  3. When pointer(20) is called, it executes Check(20) and returns true (since 20 > 10)

Output:

True


Example 7: Delegate Parameter Passing (_07Demo)

What it demonstrates:

This shows how delegates can be passed as parameters to enable loose coupling between classes.

Key Components: