Stop Indenting Your Code. Use Guard Clauses Instead #programming #coding #tutorial
Stop nesting if statements in your code, causing it to indent to the right side of the screen. By reversing your statements, you can often use guard clauses to make things easier to read. In this video, Brendan shows how to use if statements to guard, how to build custom guard methods, and how to use ardalis guard clauses in C# to clean up your code.
Sample Code Used in the Video: https://github.com/DevChatter/YouTubeSamples/tree/main/Indenting
Timestamps:
0:00 - Intro
0:46 - Nested If Statements
4:48 - Custom Guard Clauses
9:01 - Ardalis Guard Clauses
11:28 - Outro
Watch our live stream at https://www.twitch.tv/devchatter
Chat with us on Discord - https://discord.gg/aQry9jG
Contribute on GitHub - https://github.com/DevChatter/
Support DevChatter through Patreon - https://www.patreon.com/DevChatter
Follow Brendan on Twitter - https://twitter.com/brendoneus
Brendan's Pluralsight Courses - https://www.pluralsight.com/authors/brendan-enrick