.NET Guard Class Library?

后端 未结 6 1549
无人及你
无人及你 2020-12-13 15:00

I\'m looking for a library or source code that provides guard methods such as checking for null arguments. Obviously this is rather simple to build, but I\'m wondering if th

6条回答
  •  温柔的废话
    2020-12-13 15:50

    There are several methods you can use.

    My favorite is using Aspect Oriented Programming. Check out PostSharp.

    You can also take a look at Spec#, an extension to C#

    In 4.0, you will have a full-featured contract library.

    Finally, a collegue of mine has come up with a pretty useful guard library: http://blueonionsoftware.com/blog.aspx?p=ca49cb62-7ea2-43c5-96aa-91d11774fb48

提交回复
热议问题