C # Use Annotations to cancel execution of program statements

Source: Internet
Author: User
Tags define definition execution

You can use annotations (#if, #elif, #else, #endif, #define) to control the execution of statements with the following code:

public string info ()
String strionf;
#if (Hywork==false)
strionf = "Can not if";
return strionf;
#elif (Hywork==true)
strionf = "do if";
return strionf;

In the above code, you can control the execution of the statement by using the value of the name symbol (hywork). Where the value of the hywork can be defined using #define. If you use the #define definition, the Hywork value is true, or false.

Note: You must use the #define name symbol at the beginning of the program, and before any other keywords, that is to say, precede the namespace. The code that uses the #define name symbol is as follows:

#define Hywork

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.