TraceListener.WriteLine Method

Definition

Writes a message, category name, or the value of an object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

Overloads

WriteLine(Object)

Writes the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

WriteLine(String)

When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.

WriteLine(Object, String)

Writes a category name and the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

WriteLine(String, String)

Writes a category name and a message to the listener you create when you implement the TraceListener class, followed by a line terminator.

WriteLine(Object)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

Writes the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

C#
public virtual void WriteLine (object? o);
C#
public virtual void WriteLine (object o);

Parameters

o
Object

An Object whose fully qualified class name you want to write.

Remarks

The typical line terminator you might implement is a carriage return followed by a line feed (\r\n).

See also

Applies to

.NET 9 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
.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

WriteLine(String)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

When overridden in a derived class, writes a message to the listener you create in the derived class, followed by a line terminator.

C#
public abstract void WriteLine (string? message);
C#
public abstract void WriteLine (string message);

Parameters

message
String

A message to write.

Remarks

The typical line terminator you might implement is a carriage return followed by a line feed (\r\n).

Notes to Implementers

When inheriting from this class, you must implement this method. To support an indentation, call WriteIndent() if NeedIndent is true. To indent the following line, you must reset NeedIndent to true.

See also

Applies to

.NET 9 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
.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

WriteLine(Object, String)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

Writes a category name and the value of the object's ToString() method to the listener you create when you implement the TraceListener class, followed by a line terminator.

C#
public virtual void WriteLine (object? o, string? category);
C#
public virtual void WriteLine (object o, string category);

Parameters

o
Object

An Object whose fully qualified class name you want to write.

category
String

A category name used to organize the output.

Remarks

The typical line terminator you might implement is a carriage return followed by a line feed (\r\n).

See also

Applies to

.NET 9 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
.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

WriteLine(String, String)

Source:
TraceListener.cs
Source:
TraceListener.cs
Source:
TraceListener.cs

Writes a category name and a message to the listener you create when you implement the TraceListener class, followed by a line terminator.

C#
public virtual void WriteLine (string? message, string? category);
C#
public virtual void WriteLine (string message, string category);

Parameters

message
String

A message to write.

category
String

A category name used to organize the output.

Remarks

The typical line terminator you might implement is a carriage return followed by a line feed (\r\n).

See also

Applies to

.NET 9 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
.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