If you are coming to this series of posts for the first time you might check out my introductory post for a little context.
If you’re not familiar with the netfx project, you should become acquainted with it. Daniel Cazzulino (of Moq fame) and others have created an awesome set of add-on functionality to the .Net framework through these NuGet packages
Back to the Guard package:
Many .Net developers tend to write their guard clauses as such…
One problem with this is that if you were to rename the “value” parameter you have to make sure you rename the magic string “value” in the guard check.
The Guard package offers a solution that is a little more resilient to these types of rename issues as its usage will automatically either get renamed, or if you don’t you will get a compiler error.
The below test shows an example of its usage.