Insert Method

TraceListenerCollection.Insert Method (Int32, TraceListener)


Inserts the listener at the specified index.

Namespace:   System.Diagnostics
Assembly:  System (in System.dll)

public void Insert(
	int index,
	TraceListener listener


Type: System.Int32

The position in the list to insert the new TraceListener.

Type: System.Diagnostics.TraceListener

A TraceListener to insert in the list.

Exception Condition

The index is not a valid index in the list.


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

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
© 2016 Microsoft