

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is #define pre-processor directive in C#?
The #define pre-processor directive defines a sequence of characters, called symbol. It creates symbolic constants.
#define lets you define a symbol such that, by using the symbol as the expression passed to the #if directive, the expression evaluates to true.
Here is an example −
Example
#define ONE #undef TWO using System; namespace Demo { class Program { static void Main(string[] args) { #if (ONE && TWO) Console.WriteLine("Both are defined"); #elif (ONE && !TWO) Console.WriteLine("ONE is defined and TWO is undefined"); #elif (!ONE && TWO) Console.WriteLine("ONE is defined and TWO is undefined"); #else Console.WriteLine("Both are undefined"); #endif } } }
- Related Questions & Answers
- What is a pre-processor directive in C#?
- What is a conditional pre-processor directive in C#?
- What are C# pre-processor directives?
- What are the Pre-processor Commands in C language?
- Explain the pre-processor directives in C language
- What is Superscalar Processor?
- What is RISC Processor?
- What is CISC Processor?
- What is a page directive in JSP?
- What is a include directive in JSP?
- What is a taglib directive in JSP?
- What is Pre-Request Script in Postman?
- What is Pre Requests scripts in Postman?
- What is the purpose of taglib directive in JSP?
- What is the difference between VLIW architecture and Superscalar processor?
Advertisements