CodeDirectiveCollection.Add Method (CodeDirective)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Adds the specified CodeDirective object to the collection.

Namespace:   System.CodeDom
Assembly:  System (in System.dll)

public int Add(
	CodeDirective value


Type: System.CodeDom.CodeDirective

The CodeDirective object to add.

Return Value

Type: System.Int32

The index position at which the new element was inserted.

The following code example shows the use of the Add method to add a CodeDirective object to the collection. This example is part of a larger example provided for the CodeDirectiveCollection class.

// Adds a CodeDirective to the collection.
collection.Add(new CodeRegionDirective(CodeRegionMode.Start, "Region1"));

.NET Framework
Available since 2.0
Return to top