I have recently read about the Command Pattern
This pattern is used to “represent and encapsulate all the information needed to call a method at a later time.”
What is the difference between “creating an object that encapsulates method call + target object details” from a C# delegate? aren’t these both offer the same (or very similar) functionality?
It is very similar, but i think its the inverse.
A command is where something else calls on to a target delegate or object. An event is a broadcast to n-number subscribers.
Another difference is that the owner of the event doesn’t have to know about all the different subscribers.
WPF both has commands and events. Say you have a button. You could subscribe to the
Clickevent or you could have aCommandin your view model that would get invoked when the button is clicked.