System.Diagnostics.TraceListenerCollection Class

Provides a thread-safe list of System.Diagnostics.TraceListener objects.

See Also: TraceListenerCollection Members


public class TraceListenerCollection : IList


The System.Diagnostics.TraceListenerCollection list is used to specify the output listeners for the Trace.Listeners and the Debug.Listeners collections. You cannot create an instance of this class.

This list is thread-safe, however the methods used to access the list and the enumerator do not take synchronization locks. Instead, the collection is copied, the copy is modified, and a reference is set to the copy of the collection. Methods like TraceListenerCollection.Add(TraceListener), TraceListenerCollection.Remove(TraceListener), and TraceListenerCollection.Clear modify the elements in the collection.

The System.Diagnostics.TraceListenerCollection class provides the TraceListenerCollection.Count property for information about the list. It also provides the following methods: TraceListenerCollection.Contains(TraceListener), TraceListenerCollection.GetEnumerator, TraceListenerCollection.IndexOf(TraceListener).

This class also provides the following methods to modify the list: TraceListenerCollection.Add(TraceListener), TraceListenerCollection.Clear, TraceListenerCollection.Insert(int, TraceListener), and TraceListenerCollection.Remove(TraceListener). The TraceListenerCollection.CopyTo(TraceListener[], int) method copies a part of the list to an array. The TraceListenerCollection.RemoveAt(int) method deletes the list member at a specified index number.


Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,