When To Validate and When To Throw Exceptions?

Опубликовано: 30 Май 2026
на канале: Ardalis
12,060
700

When to Validate and When to Throw Exceptions (or use Guard Clauses)?

Hey everyone, I'm Steve Smith aka ardalis!

When should you rely on validation, and when should you use exceptions or guard clauses? What about return types like Result or Result of T?

Links

https://github.com/ardalis/GuardClauses
https://github.com/ardalis/Result
https://ardalis.com/guard-clauses-and...
   • What are Guard Clauses?   (What are Guard Clauses?)
https://deviq.com/design-patterns/gua...
https://www.nuget.org/packages/Ardali...
https://www.nuget.org/packages/Ardali...

Check out my courses:
https://ardalis.com/training-classes/
https://www.pluralsight.com/authors/s...

Consulting and Training: https://NimblePros.com and @nimblepros

Developer Group Mentoring: https://devBetter.com

Free Weekly Email Tips:
https://ardalis.com/tips/

If you read this far, I hope you liked the video and consider subscribing to my channel!

Find me:
https://ardalis.com
  / ardalis  
https://github.com/ardalis
  / stevenandrewsmith  
https://bsky.app/profile/ardalis.com

#dotnet #deviq #ardalis #nimblepros #visualstudio #csharp #designpatterns #guard #guards #guardclause #guardclauses #nuget #cleancode #validation #fluentvalidation #result