C # base -- preprocessing command

Source: Internet
Author: User

Preprocessing commands are mainly used to influenceProgramTo provide the compilation information or prohibited part.CodeC # does not have the same independent pre-processor as C ++, and the pre-processing commands are also processed by the compiler.

1. # define, # UNDEF is used to declare or delete symbol definitions. # define and # UNDEF must be placed in the first line of the file, and the defined symbols (variables) are valid only within the current file range.

2. # If, # Elif, # else, # endif is used to determine whether the identified code block needs to be compiled based on the defined symbols/variables. If not, it is not compiled, the generated executable file will be reduced accordingly.

  # define  debug  using  system;  using  system. collections. generic;  using  system. LINQ;  using  system. text;  namespace  client { class   defineclass  { Public static void  Print () {# If  DEBUG = false  console. writeline ("print");  #endif }}

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.