Class and Method Level Comments

Problem
You want to know how to apply inline documentation for classes and methods when needed.

Solution
Add a comment before the definition of a class or method, and use a blank line to create separation between the comment and code.

More Details
The comments should describe WHAT a class or method does; not HOW it works. Consider using lines of asterisks or dashes to make the comments stand out.

Examples

// ------------------------------------------------------------
// The Account class holds data about an account in the system.
// ------------------------------------------------------------

public class Account
{
    // -----------------------------------
    // Return the balance of this account.
    // -----------------------------------

    public string AccountBalance()
    {
        ...
    }

    ...
}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s