NuGet Project Uncovered: Guard
If you are coming to this series of posts for the first time you might check out my introductory post for a little context.
Guard is one of the MANY projects coming out of the netfx project. (HOLY NUGET there?s a ton of these).
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 it?s 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.
Thanks for the pointer.
The linked Guard package is obsolete. I think you mean
http://nuget.org/packages/netfx-Guard
Fixed. Thanks!
That’s an interesting variation on the early binding INotifyPropertyChanged implementation that I’ve seen used a lot (and use myself).