TraceListenerCollection.Insert(Int32, TraceListener) Метод
Определение
Вставляет прослушиватель по указанному индексу.Inserts the listener at the specified index.
public:
void Insert(int index, System::Diagnostics::TraceListener ^ listener);
public void Insert (int index, System.Diagnostics.TraceListener listener);
member this.Insert : int * System.Diagnostics.TraceListener -> unit
Public Sub Insert (index As Integer, listener As TraceListener)
Параметры
- index
- Int32
Позиция в списке для вставки нового объекта TraceListener.The position in the list to insert the new TraceListener.
- listener
- TraceListener
Объект TraceListener, который требуется вставить в список.A TraceListener to insert in the list.
Исключения
Значение параметра index
не является допустимым индексом в списке.The index
is not a valid index in the list.
listener
имеет значение null
.listener
is null
.
Комментарии
Если индекс равен числу элементов в списке, то прослушиватель добавляется в конец списка.If the index equals the number of items in the list, then the listener is appended to the end of the list.
Индексация начинается с нуля.The index is zero-based. Поэтому, если вы хотите вставить прослушиватель в третье расположение, необходимо вызвать myTraceListenerColl.Insert(2, myNewListener)
.Therefore, if you want to insert the listener into the third position, you must call myTraceListenerColl.Insert(2, myNewListener)
.