This documentation is archived and is not being maintained.

TraceListenerCollection.Insert Method

Inserts the listener at the specified index.

[Visual Basic]
Public Sub Insert( _
   ByVal index As Integer, _
   ByVal listener As TraceListener _
)
[C#]
public void Insert(
 int index,
 TraceListener listener
);
[C++]
public: void Insert(
 int index,
 TraceListener* listener
);
[JScript]
public function Insert(
   index : int,
 listener : TraceListener
);

Parameters

index
The position in the list to insert the new TraceListener.
listener
A TraceListener to insert in the list.

Exceptions

Exception Type Condition
ArgumentOutOfRangeException The index is not a valid index in the list.

Remarks

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. Therefore, if you want to insert the listener into the third position, you must call myTraceListenerColl.Insert(2, myNewListener).

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

TraceListenerCollection Class | TraceListenerCollection Members | System.Diagnostics Namespace | TraceListenerCollection | TraceListener | DefaultTraceListener | TextWriterTraceListener | Debug | Trace

Show: