Programming Tutorials

Comments in C#

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

C# utilizes a double forward slash (//) to indicate the rest of the line is a comment. This is inherited from C++.

public class Foo
{
    // a comment
    public static void Bar(int firstParam) {}  //Also a comment
}
Multi-line comments can be indicated by a starting forward slash/asterisk (/*) and ending asterisk/forward slash (*/). This is inherited from standard C.
public class Foo
{
    /* A Multi-Line
       comment  */
    public static void Bar(int firstParam) {}  
}





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Csharp )

Latest Articles (in Csharp)