Share via


CustomErrorCollection.RemoveAt(Int32) 方法

定義

從集合中的指定索引位置移除 CustomError 物件。

public:
 void RemoveAt(int index);
public void RemoveAt (int index);
member this.RemoveAt : int -> unit
Public Sub RemoveAt (index As Integer)

參數

index
Int32

要移除的 CustomError 物件集合索引。

範例

下列程式碼範例示範如何移除 CustomError 位於指定索引處的物件。 請參閱類別主題中的 CustomErrorCollection 程式碼範例,以瞭解如何取得集合。

// Using method RemoveAt.
if (!customErrorsSection.SectionInformation.IsLocked)
{
    // Remove the error at 0 index
    customErrorsCollection.RemoveAt(0);
    configuration.Save();
}
' Using method RemoveAt.
If Not customErrorsSection.SectionInformation.IsLocked Then
   ' Remove the error at 0 index
   customErrorsCollection.RemoveAt(0)
   configuration.Save()
End If

備註

方法會將 RemoveAtremove 專案 customErrors 插入組態檔目前階層層級的 區段。 這是移除階層中較高層級上父組態檔中定義的元素參考 add

注意 元素 add 不會從父組態檔中刪除。 它們只會停用。 不過, RemoveAt 方法實際上會在目前的階層層級刪除它們。

適用於