Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Microsoft

Implement delegates and events

Microsoft via Microsoft Learn

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
  • Learn how to declare, instantiate, and invoke delegates for scenarios that require dynamic method invocation, such as callback methods and custom sorting or filtering. Learn how to use delegates to create flexible and extensible code that can adapt to changing requirements.
    • Explain the concept of delegates in C# and their benefits in terms of flexibility, extensibility, and decoupling.

    • Describe how to declare, instantiate, and invoke delegates using various methods, including named methods, anonymous methods, and lambda expressions.

    • Explain how delegates are used in sorting, callback, and other real-world scenarios.

    • Describe how strongly typed delegates like Action and Func simplify your code and improve readability.

    • Explain how variance in C# enhances flexibility in method signatures with delegates.

    • Implement delegates in a C# application.

  • Discover how events facilitate communication between objects in C#, and how their integration with delegates creates robust, decoupled code.
    • Understand Events and Delegates in C#.

    • Examine and Declare Events in C#.

    • Encapsulate and Raise Events in C#.

    • Manage Event Subscription and Unsubscription in C#.

Syllabus

  • Get started with Delegates
    • Introduction
    • Examine late binding with delegates
    • Instantiate and invoke delegate types
    • Examine strongly typed delegates
    • Examine variance in delegates
    • Exercise: Implement delegates in a C# app
    • Module assessment
    • Summary
  • Create and manage events
    • Introduction
    • Examine events in C#
    • Declare events in C#
    • Subscribe and unsubscribe from events in C#
    • Explore delegates and events relationship in C#
    • Exercise: Implement events in C#
    • Module assessment
    • Summary

Reviews

Start your review of Implement delegates and events

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.