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 _
public void Insert(
 int index,
 TraceListener listener
public: void Insert(
 int index,
 TraceListener* listener
public function Insert(
   index : int,
 listener : TraceListener


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


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


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).


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