I read honestly, and I am at a stage where I am beginning to understand what they are doing, but I am at a loss when it comes to why and where I will use them. In each example, I saw that a repeating definition looks like a method pointer, and you can use it instead of calling a method, which seems to be useful when the developer does not know which method to call or select a method based on state or state.
Here I'm struggling a bit, why can't I just have an if statement or a switch statement and then call the method directly based on the result? What's wrong with calling a method directly from an object instance? In my opinion, the delegate offers a better way to do this, but I can’t understand what is better about it, from my point of view, this is just a round-robin way to achieve the same thing as the if statement when you decide which method to call.
I am perplexed and chatting a little now, any help on this issue would be very appreciated!
source share