JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Detailed breakdown of subscription ( +=)

    C# SELF
    53 level,0 lecture
    We dissect how event subscription works in C#: what multicast delegates and their invocation list are, how the compiler expands +=/ -= into calls to Delegate. Combine/ Remove, what the event keyword protects you from, and what traps show up with multiple subscriptions and lambdas. All with hands-on examples using EventHandler and a walkthrough of the gotchas.
    Open
  • Unsubscribing from events ( -=) and memory leaks

    C# SELF
    53 level,1 lecture
    In this lecture we'll cover why a forgotten subscription to an event leads to memory leaks in .NET, how to properly unsubscribe using the -= operator, where and when to do the unsubscription (including implementing IDisposable), how to safely work with lambda expressions, and common mistakes developers make when working with events.
    Open
  • Subscribers and safe event invocation

    C# SELF
    53 level,2 lecture
    We break down how event subscriptions work in C#: adding and removing handlers, what's behind delegates and the invocation list, why it's important to unsubscribe, and how to safely raise events in multithreaded code. We'll talk about pitfalls (exceptions in handlers, data races) and practical techniques: copying the delegate to a local variable, iterating via GetInvocationList(), one-shot subscriptions and bulk unsubscription.
    Open
  • Pattern "Observer" ( Observer)

    C# SELF
    53 level,3 lecture
    In this lecture we'll break down the design pattern Observer: how to decouple the publisher from subscribers so you don't violate OCP, and how this is elegantly implemented in C# via events and delegates. We'll compare a "manual" implementation using interfaces and an observer list with the events-based variant ( EventHandler<T>), attach multiple listeners to Worker, discuss advantages and common pitfalls (leaks due to unsubscribed subscribers, double subscription, exceptions in handlers), and visualize a common leak pattern.
    Open
  • Practical Scenarios and Best Practices

    C# SELF
    53 level,4 lecture
    In this lecture we'll look at real-world scenarios for using events in .NET: reacting to user actions, progress and completion notifications, lifecycle events of domain objects, working in multithreaded environments (marshaling via SynchronizationContext/ Dispatcher) and the Event Aggregator pattern. We'll discuss best practices: standard delegates EventHandler/ EventHandler<T>, immutable EventArgs, safe invocation via ?.Invoke, encapsulation via OnEventName, unsubscribing to prevent leaks, and thread-safety.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy