Mariusz Postol

Mariusz Postol

  • 584
  • 1.8k
  • 20.9k

Callback vs IoC

Jun 11 2024 7:57 AM

The callback concept is implemented using:

  1. Delegates: Delegates are a fundamental construct in C# that enables late binding scenarios allowing the definition of a type-safe reference to a method, which can then be invoked dynamically at runtime. In essence, delegates provide a way to call methods indirectly, allowing for flexibility in the method invocation.
  2. Events: Events are built using the language support for delegates - an event is essentially a delegate with additional restrictions. Only the class containing the event can invoke it, while other classes can subscribe to listen to those events.

The  Inversion of Control (IoC) is a design principle in software engineering. IoC reverses traditional control structures, making code more flexible and easier to test.

 

For me looks the same. My point is that the IoC concept can be implemented using the events and delegates constructs. Do you agree?


Answers (1)