DelimitedListTraceListener 构造函数

定义

初始化 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class.

重载

DelimitedListTraceListener(Stream)

初始化写入指定输出流的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream.

DelimitedListTraceListener(TextWriter)

初始化写入指定文本编写器的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer.

DelimitedListTraceListener(String)

初始化写入指定文件的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file.

DelimitedListTraceListener(Stream, String)

初始化写入指定输出流并具有指定名称的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified output stream and has the specified name.

DelimitedListTraceListener(TextWriter, String)

初始化写入指定文本编写器并具有指定名称的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified text writer and has the specified name.

DelimitedListTraceListener(String, String)

初始化写入指定文件并具有指定名称的 DelimitedListTraceListener 类的新实例。Initializes a new instance of the DelimitedListTraceListener class that writes to the specified file and has the specified name.

DelimitedListTraceListener(Stream)

初始化写入指定输出流的 DelimitedListTraceListener 类的新实例。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)

参数

stream
Stream

接收输出的 StreamThe Stream to receive the output.

例外

streamnullstream is null.

注解

此构造函数将 Name 属性初始化为空字符串 ( "" ) 。This constructor initializes the Name property to an empty string ("").

适用于

DelimitedListTraceListener(TextWriter)

初始化写入指定文本编写器的 DelimitedListTraceListener 类的新实例。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)

参数

writer
TextWriter

接收输出的 TextWriterThe TextWriter to receive the output.

例外

writernullwriter is null.

注解

此构造函数将 Name 属性初始化为空字符串 ( "" ) 。This constructor initializes the Name property to an empty string ("").

适用于

DelimitedListTraceListener(String)

初始化写入指定文件的 DelimitedListTraceListener 类的新实例。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)

参数

fileName
String

要接收输出的文件的名称。The name of the file to receive the output.

例外

fileNamenullfileName is null.

注解

此构造函数将 Name 属性初始化为空字符串 ( "" ) 。This constructor initializes the Name property to an empty string ("").

适用于

DelimitedListTraceListener(Stream, String)

初始化写入指定输出流并具有指定名称的 DelimitedListTraceListener 类的新实例。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)

参数

stream
Stream

接收输出的 StreamThe Stream to receive the output.

name
String

跟踪侦听器的新实例的名称。The name of the new instance of the trace listener.

例外

streamnullstream is null.

注解

此构造函数将 Name 属性初始化为参数的值 name ,如果参数为,则将属性初始化为空字符串 ( "" ) name nullThis constructor initializes the Name property to the value of the name parameter, or to an empty string ("") if the name parameter is null. Name属性可用作集合中的索引 Listeners ,以编程方式更改侦听器的属性。The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. 例如,下面的代码将设置 Delimiter 名称为 "delimListener" 的实例的属性 DelimitedListTraceListenerFor example, the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

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

适用于

DelimitedListTraceListener(TextWriter, String)

初始化写入指定文本编写器并具有指定名称的 DelimitedListTraceListener 类的新实例。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)

参数

writer
TextWriter

接收输出的 TextWriterThe TextWriter to receive the output.

name
String

跟踪侦听器的新实例的名称。The name of the new instance of the trace listener.

例外

writernullwriter is null.

注解

此构造函数将 Name 属性初始化为参数的值 name ,如果参数为,则将属性初始化为空字符串 ( "" ) name nullThis constructor initializes the Name property to the value of the name parameter, or to an empty string ("") if the name parameter is null. Name属性可用作集合中的索引 Listeners ,以编程方式更改侦听器的属性。The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. 例如,下面的代码将设置 Delimiter 名称为 "delimListener" 的实例的属性 DelimitedListTraceListenerFor example the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

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

适用于

DelimitedListTraceListener(String, String)

初始化写入指定文件并具有指定名称的 DelimitedListTraceListener 类的新实例。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)

参数

fileName
String

要接收输出的文件的名称。The name of the file to receive the output.

name
String

跟踪侦听器的新实例的名称。The name of the new instance of the trace listener.

例外

fileNamenullfileName is null.

注解

此构造函数 StreamWriter 使用编码为指定路径上的指定文件初始化类的新实例 UTF8This 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.

备注

若要减少异常的几率,任何可能使输出无效的字符都将替换为 "?" 字符。To reduce the chance of an exception, any character that might invalidate the output is replaced with a "?" character.

Name如果参数为,则将属性设置为 name 参数的值,或设置为空字符串 ( "" ) name nullThe Name property is set to the value of the name parameter, or to an empty string ("") if the name parameter is null. Name属性可用作集合中的索引 Listeners ,以编程方式更改侦听器的属性。The Name property can be used as an index into the Listeners collection to programmatically change the properties for the listener. 例如,下面的代码将设置 Delimiter 名称为 "delimListener" 的实例的属性 DelimitedListTraceListenerFor example, the following code sets the Delimiter property for the instance of DelimitedListTraceListener that has the name "delimListener":

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

适用于