DelimitedListTraceListener Constructors

Definition

Initializes a new instance of the DelimitedListTraceListener class.

Overloads

DelimitedListTraceListener(Stream)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream.

DelimitedListTraceListener(TextWriter)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer.

DelimitedListTraceListener(String)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file.

DelimitedListTraceListener(Stream, String)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream and has the specified name.

DelimitedListTraceListener(TextWriter, String)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer and has the specified name.

DelimitedListTraceListener(String, String)

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file and has the specified name.

DelimitedListTraceListener(Stream)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream.

C#
public DelimitedListTraceListener(System.IO.Stream stream);

Parameters

stream
Stream

The Stream to receive the output.

Exceptions

stream is null.

Remarks

This constructor initializes the Name property to an empty string ("").

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

DelimitedListTraceListener(TextWriter)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer.

C#
public DelimitedListTraceListener(System.IO.TextWriter writer);

Parameters

writer
TextWriter

The TextWriter to receive the output.

Exceptions

writer is null.

Remarks

This constructor initializes the Name property to an empty string ("").

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

DelimitedListTraceListener(String)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file.

C#
public DelimitedListTraceListener(string? fileName);
C#
public DelimitedListTraceListener(string fileName);

Parameters

fileName
String

The name of the file to receive the output.

Exceptions

fileName is null.

Remarks

This constructor initializes the Name property to an empty string ("").

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 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

DelimitedListTraceListener(Stream, String)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream and has the specified name.

C#
public DelimitedListTraceListener(System.IO.Stream stream, string? name);
C#
public DelimitedListTraceListener(System.IO.Stream stream, string name);

Parameters

stream
Stream

The Stream to receive the output.

name
String

The name of the new instance of the trace listener.

Exceptions

stream is null.

Remarks

This constructor initializes the Name property to the value of the name parameter, or to an empty string ("") if the name parameter is null. The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example, the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

C#
((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"  

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

DelimitedListTraceListener(TextWriter, String)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer and has the specified name.

C#
public DelimitedListTraceListener(System.IO.TextWriter writer, string? name);
C#
public DelimitedListTraceListener(System.IO.TextWriter writer, string name);

Parameters

writer
TextWriter

The TextWriter to receive the output.

name
String

The name of the new instance of the trace listener.

Exceptions

writer is null.

Remarks

This constructor initializes the Name property to the value of the name parameter, or to an empty string ("") if the name parameter is null. The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

C#
((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"  

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

DelimitedListTraceListener(String, String)

Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs
Source:
DelimitedListTraceListener.cs

Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file and has the specified name.

C#
public DelimitedListTraceListener(string? fileName, string? name);
C#
public DelimitedListTraceListener(string fileName, string name);

Parameters

fileName
String

The name of the file to receive the output.

name
String

The name of the new instance of the trace listener.

Exceptions

fileName is null.

Remarks

This constructor initializes a new instance of the StreamWriter class for the specified file on the specified path, using UTF8 encoding. If the file exists, it is appended to. If the file does not exist, a new file is created.

Note

To reduce the chance of an exception, any character that might invalidate the output is replaced with a "?" character.

The Name property is set to the value of the name parameter, or to an empty string ("") if the name parameter is null. The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. For example, the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

C#
((DelimitedListTraceListener)Trace.Listeners["delimListener"]).Delimiter = ":"  

Applies to

.NET 10 and other versions
Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 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