Preprocessor directives in C#

By: Ram Baskar Emailed: 1696 times Printed: 2194 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

C# features "preprocessor directives" (though it does not have an actual preprocessor) based on the C preprocessor that allow programmers to define symbols but not macros. Conditionals such as #if, #endif, and #else are also provided. Directives such as #region give hints to editors for code folding.

public class Foo
{
    #region Procedures
    public void IntBar(int firstParam) {} 
    public void StrBar(string firstParam) {} 
    public void BoolBar(bool firstParam) {} 
    #endregion

    #region Constructors
    public Foo() {}
    public Foo(int firstParam) {}
    #endregion

}

Csharp Home | All Csharp Tutorials | Latest Csharp Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(1)


1. View Comment

I use this all the time. You can use this exactly like you've used C++ macros that can be controlled from compile command line and create multiple deliverable versions based off the same source code base

View Tutorial          By: Chetan at 2015-09-08 08:56:06

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Ram Baskar
Hello World sample program in C#
Comments in C#
Preprocessor directives in C#
Boxing and unboxing in C#
Categories of datatypes in C#
Major features of C#
Which version of C# to use?
History of C#?
Why it was named C#?
Design Goals of C#
What is C#?
A complete sample program in AJAX
Handling the Server Response in AJAX
How to Make an HTTP Request in AJAX

More Tutorials in Csharp
Major features of C#
Categories of datatypes in C#
Boxing and unboxing in C#
Preprocessor directives in C#
Comments in C#
Hello World sample program in C#
SOAP serialization in C#
What is C#?
Design Goals of C#
Why it was named C#?
History of C#?
Which version of C# to use?
Convert Image to Base64 String in C#
Convert Base64 String to Image in C#

More Latest News
Most Viewed Articles (in Csharp )
Convert Image to Base64 String in C#
SOAP serialization in C#
Boxing and unboxing in C#
Preprocessor directives in C#
Convert Base64 String to Image in C#
What is C#?
Design Goals of C#
Why it was named C#?
History of C#?
Which version of C# to use?
Major features of C#
Categories of datatypes in C#
Comments in C#
Hello World sample program in C#
Most Emailed Articles (in Csharp)
Hello World sample program in C#
Convert Image to Base64 String in C#
Categories of datatypes in C#
Convert Base64 String to Image in C#
SOAP serialization in C#
Design Goals of C#
Why it was named C#?
History of C#?
Which version of C# to use?
What is C#?
Major features of C#
Boxing and unboxing in C#
Preprocessor directives in C#
Comments in C#