CodeDirectiveCollection.Insert(Int32, CodeDirective) 方法
定义
将指定的 CodeDirective 对象插入集合中指定的索引位置。Inserts the specified CodeDirective object into the collection at the specified index.
public:
void Insert(int index, System::CodeDom::CodeDirective ^ value);
public void Insert (int index, System.CodeDom.CodeDirective value);
member this.Insert : int * System.CodeDom.CodeDirective -> unit
Public Sub Insert (index As Integer, value As CodeDirective)
参数
- index
- Int32
从零开始的索引位置,应在此处插入指定对象。The zero-based index position where the specified object should be inserted.
- value
- CodeDirective
要插入的 CodeDirective 对象。The CodeDirective object to insert.
例外
index 小于 0。index is less than 0.
示例
下面的代码示例演示如何使用方法在 Insert CodeDirective 集合的索引0处插入对象。The following code example shows the use of the Insert method to insert a CodeDirective object at index 0 of the collection. 此示例是为类提供的更大示例的一部分 CodeDirectiveCollection 。This example is part of a larger example provided for the CodeDirectiveCollection class.
// Inserts a CodeDirective at index 0 of the collection.
collection.Insert(0, new CodeRegionDirective(CodeRegionMode.Start, "Region1"));
' Inserts a CodeDirective at index 0 of the collection.
collection.Insert(0, New CodeRegionDirective(CodeRegionMode.Start, "Region1"))