Learning new logic
Learning about delegates, events, and actions are practices of writing effective code. Delegates hold methods. In order to utilize a delegate, you must ensure that the class holds the same parameters as the delegate method. An event creates a specialized delegate. It allows you to broadcast a specific code, enabling subscribers. An example of this would be in a video game, if your teammate’s health status is declining it can alert only the members of your team. You wouldn’t want the opposing team to know that your teammate is in a vulnerable health state, so you would subscribe to communication within your group that is only visible to y’all. Events allow objects to be independent while still in communication with other classes. Actions are identical to delegates and events. Delegates and events go hand in hand, while actions are the accumulation of them both. Actions are a cleaner more efficient way to a delegate/event method. They use one line of code rather than 2. The only thing about actions is that they require a new namespace in order to access the code library for actions. They were introduced in a more recent series. This is an example of how code and programming is constantly changing, allowing for more efficient practices that perform the same tasks.