Programming Tutorials

Preprocessor directives in C#

By: Ram Baskar in Csharp Tutorials on 2011-02-05  

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) {} 

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


Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in Csharp )

Latest Articles (in Csharp)