TraceListener.Write 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.

Overloads

Write(Object)

Writes the value of the object's ToString() method to the listener you create when you implement the TraceListener class.

Write(String)

When overridden in a derived class, writes the specified message to the listener you create in the derived class.

Write(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.

Write(String, String)

Writes a category name and a message to the listener you create when you implement the TraceListener class.

Write(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.

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

Parameters

o
Object

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

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

Write(String)

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

When overridden in a derived class, writes the specified message to the listener you create in the derived class.

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

Parameters

message
String

A message to write.

Notes to Implementers

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

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

Write(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.

C#
public virtual void Write(object? o, string? category);
C#
public virtual void Write(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.

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

Write(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.

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

Parameters

message
String

A message to write.

category
String

A category name used to organize the output.

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