Редагувати

Поділитися через


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.

public:
 DelimitedListTraceListener(System::IO::Stream ^ stream);
public DelimitedListTraceListener (System.IO.Stream stream);
new System.Diagnostics.DelimitedListTraceListener : System.IO.Stream -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (stream As 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

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.

public:
 DelimitedListTraceListener(System::IO::TextWriter ^ writer);
public DelimitedListTraceListener (System.IO.TextWriter writer);
new System.Diagnostics.DelimitedListTraceListener : System.IO.TextWriter -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (writer As TextWriter)

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

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.

public:
 DelimitedListTraceListener(System::String ^ fileName);
public DelimitedListTraceListener (string? fileName);
public DelimitedListTraceListener (string fileName);
new System.Diagnostics.DelimitedListTraceListener : string -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (fileName As String)

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

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.

public:
 DelimitedListTraceListener(System::IO::Stream ^ stream, System::String ^ name);
public DelimitedListTraceListener (System.IO.Stream stream, string? name);
public DelimitedListTraceListener (System.IO.Stream stream, string name);
new System.Diagnostics.DelimitedListTraceListener : System.IO.Stream * string -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (stream As Stream, name As String)

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

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

Applies to

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.

public:
 DelimitedListTraceListener(System::IO::TextWriter ^ writer, System::String ^ name);
public DelimitedListTraceListener (System.IO.TextWriter writer, string? name);
public DelimitedListTraceListener (System.IO.TextWriter writer, string name);
new System.Diagnostics.DelimitedListTraceListener : System.IO.TextWriter * string -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (writer As TextWriter, name As String)

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

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

Applies to

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.

public:
 DelimitedListTraceListener(System::String ^ fileName, System::String ^ name);
public DelimitedListTraceListener (string? fileName, string? name);
public DelimitedListTraceListener (string fileName, string name);
new System.Diagnostics.DelimitedListTraceListener : string * string -> System.Diagnostics.DelimitedListTraceListener
Public Sub New (fileName As String, name As String)

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

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

Applies to