Ray's playground

 

Item 4: Use Conditional Attributes Instead of #if(Effective C#)

  The Conditional attribute generates more efficient IL than #if/#endif does. It also has the advantage of being applicable only at the function level, which forces you to better structure your conditional code. The compiler uses the Conditional attribute to help you avoid the common errors we have all made by placing the #if or #endif in the wrong spot. The Conditional attribute provides better support for you to cleanly separate conditional code than the preprocessor did.

 

posted on 2011-01-09 22:31  Ray Z  阅读(231)  评论(0编辑  收藏  举报

导航