TraceListenerCollection.Item[] Property

Definition

Gets or sets the specified TraceListener.

Overloads

Item[Int32]

Gets or sets the TraceListener at the specified index.

Item[String]

Gets the first TraceListener in the list with the specified name.

Item[Int32]

Source:
TraceListeners.cs
Source:
TraceListeners.cs
Source:
TraceListeners.cs

Gets or sets the TraceListener at the specified index.

C#
public System.Diagnostics.TraceListener this[int i] { get; set; }

Parameters

i
Int32

The zero-based index of the TraceListener to get from the list.

Property Value

A TraceListener with the specified index.

Exceptions

The value is null.

Remarks

The index is zero-based. Therefore, you must subtract one from the numerical position of a particular TraceListener to access that TraceListener. For example, to get the third TraceListener, you need to specify myTraceListenerColl[2].

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Item[String]

Source:
TraceListeners.cs
Source:
TraceListeners.cs
Source:
TraceListeners.cs

Gets the first TraceListener in the list with the specified name.

C#
public System.Diagnostics.TraceListener? this[string name] { get; }
C#
public System.Diagnostics.TraceListener this[string name] { get; }

Parameters

name
String

The name of the TraceListener to get from the list.

Property Value

The first TraceListener in the list with the given Name. This item returns null if no TraceListener with the given name can be found.

Remarks

The Item[] property is case-sensitive when searching for names. That is, if two listeners exist with the names "Lname" and "lname", Item[] property will find only the TraceListener with the Name that you specify, not both.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1