The text of this article is not in this database — only its details are. Read it on the old site: Preprocessor Directive in C#
10 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: Preprocessor Directive in C#
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Gowtham RajamanickamPosted Apr 12, 2016, 2:11 AM
Good One, Thanks for sharing
Sukesh MarlaPosted Sep 11, 2012, 2:30 PM
thanks aman
Aman SinghalPosted Sep 11, 2012, 9:33 AM
good article for understanding preprocessor directives in C#.
Sukesh MarlaPosted Sep 11, 2012, 6:55 AM
You can use them if you want to restrict compliler from compiling something..Like For Example, Consider you want a block has to be complied in debug mode but not it release mode.
Rohatash KumarPosted Sep 11, 2012, 4:07 AM
When to use preprocessor directives in .net ? Sukesh
Sukesh MarlaPosted Sep 10, 2012, 11:07 PM
Thanks Mahesh sir, even i does :)
Sukesh MarlaPosted Sep 10, 2012, 11:06 PM
Thanks a lot for your inputs Akkiraju and Sam I was accepting some inputs in http://www.c-sharpcorner.com/UploadFile/SukeshMarla/Asp-Net-best-practices/ http://www.c-sharpcorner.com/UploadFile/SukeshMarla/Asp-Net-performance-practices/ because always developers always try to do better than previous one, so every input you give will be precious.
Mahesh ChandPosted Sep 10, 2012, 9:28 PM
Good article Sukesh. It is rare to see articles on topic like this. And yes I use #if DEBUG a lot :). Cheers!
Akkiraju IvaturieditedPosted Sep 10, 2012, 7:14 PMEdited Sep 10, 2012, 7:15 PM
I just want to add one more to the above: #if DEBUG //code to run when in debug mode #else //code to run when in release mode #endif
Sam HobbsPosted Sep 10, 2012, 5:56 PM
Thank you Sukesh for the somewhat unnoticed concepts. I just want to add that in case anyone is wondering why #define is not used more, the answer is that many experienced developers consider it to be something to be avoided and obviously Microsoft agrees. The #define in C# is very much like #define in C++ and in C++ a #define is also called a macro. See what the designer of C++, Bjarne Stroustrup, says about macros in: http://www.stroustrup.com/bs_faq2.html#macro