Class vs. Callback Commands - EASY WPF (.NET 5)
I demonstrate how to implement commands as classes rather than using Relay, Callback, or Delegate commands. Class commands allow multiple view models to use the same command, will lead to simpler view models, can help debugging, and can lead to cleaner unit tests. I believe the benefits of class commands over callback commands outweigh the potential drawbacks. As a result, I implement nearly ALL of my commands as classes. However, I still understand that callback commands are beneficial in some cases. Choose the best option for your scenario! TIMESTAMPS: 0:00 - Introduction 0:45 - Demo Introduction 2:45 - Creating a Class Command 6:20 - Using the Class Command 7:05 - Supporting Multiple View Models 10:42 - Benefits 11:42 - Unit Testing Benefits 13:33 - Potential Drawbacks 16:05 - Base Command 16:55 - Creating More Class Commands 18:58 - Conclusion EVENT MEMORY LEAKS: https://michaelscodingspot.com/5-techniques-to-avoid-memory-leaks-by-events-in-c-net-you-should-know/ SOURCE CODE: https://github.com/SingletonSean/wpf-tutorials/tree/master/ClassCommands OTHER LINKS: Donations: https://www.paypal.com/biz/fund?id=UBZCZWX2UVWJE
Download
0 formatsNo download links available.