Assembly: System (in system.dll)
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 Add, Remove, and Clear modify the elements in the collection.
This class also provides the following methods to modify the list: Add, Clear, Insert, and Remove. The CopyTo method copies a part of the list to an array. The RemoveAt method deletes the list member at a specified index number.
The following example creates a TextWriterTraceListener that writes to the console screen. The code then adds the new listener to the Trace.Listeners.
/* Create a ConsoleTraceListener and add it to the trace listeners. */ ConsoleTraceListener myWriter = new ConsoleTraceListener(); Trace.Listeners.Add(myWriter);
/* Create a ConsoleTraceListener and add it to the trace listeners. */ ConsoleTraceListener myWriter = new ConsoleTraceListener(); Trace.get_Listeners().Add(myWriter);
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.