Use Delegates and Events
Compose typed callbacks while controlling capture and subscription lifetime.
Typed callables
Action, Func, Predicate and EventHandler-shaped APIs provide compile-time typed callback patterns. They are not late-bound managed delegates.
Design lifetime explicitly
- Prefer value captures for immutable data.
- Use weak ownership when a callback can outlive its target.
- Unsubscribe or cancel before destroying an object referenced by the callback.
- Treat async callbacks and timer handlers as concurrency boundaries.
Composition
Delegate composition can model multicast behavior for the implemented subset, but exception propagation, removal identity and concurrent modification deserve tests in the consumer’s use case.
No DynamicInvoke
Late-bound DynamicInvoke is deliberately unsupported and throws NotImplementedException. Use typed invocation.