我正在寻找有趣的PostSharp方面 - 任何你觉得有用并且不介意分享的。
D. Patrick Caldwell在他的博客上提出了一些很酷的想法。
使用属性和PostSharp验证参数 http://dpatrickcaldwell.blogspot.com/2009/03/validate-parameters-using-attributes.html
使用PostSharp的Memoizer属性 http://dpatrickcaldwell.blogspot.com/2009/02/memoizer-attribute-using-postsharp.html
[Log(LogLevel.Info, "Counting characters.")]
int CountCharacters(string arg) {
return arg.Length;
}
这个问题有点傻,但这不是贡献目录的目的吗?
有一个自动属性更改实现的例子 - INotifyPropertyChanged。