Monday, April 8, 2024

Command Design Pattern in C#

The Command Design Pattern is a behavioral design pattern that encapsulates a request as an object, thereby allowing parameterization of clients with queues, requests, and operations. This pattern decouples sender and receiver of a request based on a command, which helps in invoking the right method at the right time without knowing the actual implementation details.

Components of Command Design Pattern

  1. Command: Defines an interface for executing an operation.
  2. Concrete Command: Implements the Command interface and binds a receiver with an action. It defines a binding between the action and the receiver.
  3. Invoker: Requests the command to execute the operation.
  4. Receiver: Knows how to perform the operation.
^ Scroll to Top