9.1. Inline Commenting
All programming languages supported by Visual Studio provide a method for adding inline documentation. By default, all inline comments are highlighted in green.
Visual Basic .NET uses a single quote character to denote anything following it to be a comment, as shown in the following code listing:
Public Sub New(ByVal Username As String, ByVal Password As String) ' This call is required by the Windows Form Designer. InitializeComponent() ' Perform the rest of the class initialization, which for now ' means we just save the parameters to private data members _username = Username 'This includes the domain name _password = Password End Sub
C# supports both single-line comments and comment blocks. Single-line comments are denoted by // at the beginning of the comment. Block comments typically span multiple lines and are opened by /* and closed off by */, as shown in the following code listing:
public UserRights(string Username, string Password) { // This call is required by the Windows Form Designer. InitializeComponent(); /* * Perform the rest of the class initialization, which for now * means we just save the parameters to private data members */ _username = Username; //This includes the domain name _password = Password; }
Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.