I need to know the usage of #if in C#…Thanks..
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
#ifis a pre-processor command.It’s most common usage (which some might say is an abuse) is to have code that only compiles in debug mode:
One very good use (as StingyJack points out) is to allow easy debugging of a Windows Service:
Source
This means that running release mode will start the service as expected, while running in debug mode will allow you to actually debug the code.