C# Namespace Guidelines

Let’s create some guidelines for documenting .Net Namespace.

For example, let’s look at the System.Collections Namespace. What do we notice?

Namespace – define the namespace using the following convention: System.Collections Namespace

Purpose – describe the purpose of the namespace, for example:

The System.Collections namespace contains interfaces and classes that define various collections of objects, such as lists, queues, bit arrays, hash tables and dictionaries.

Classes

We then identify the classes related to the namespace. For each, we identify it and describe its purpose. Use the correct case when documenting the
classes.

Note: it’s ArrayList, not Arraylist or arrayList.

Class Description

ArrayList – implements the IList interface using an array whose size is dynamically increased as required. Note how IList is spelt. Both the I for
Interface and L for List are capitalized.

BitArray – manages a compact array of bit values, which are represented as Booleans. True indicates that the bit is on (1). False indicates the bit is off
(0).

CaseInsensitiveComparer – compares two objects for equivalence, ignoring the case of strings.

CaseInsensitiveHashCodeProvider – Obsolete.

Structures

Next, identify the structure related to the namespace.

Structure Description

Dictionary Entry Defines a dictionary key/value pair that can be set or retrieved.

Interfaces

For interfaces, note the casing for IDictionaryEnumerator. I for Interface and D for Dictionary and E for Enumerator are capitalized.

Interface Description

ICollection – Defines size, enumerators, and synchronization methods for all nongeneric collections.

IComparer – Exposes a method that compares two objects.

IDictionary – Represents a nongeneric collection of key/value pairs.

IDictionaryEnumerator – Enumerates the elements of a nongeneric dictionary.

Use verb constructions to describe the purpose of each interface.