Table of Contents

Method WriteMessage

Namespace
Ploch.CommandLine.Spectre.Output
Assembly
Ploch.CommandLine.Spectre.dll

WriteMessage<TMessage>(TMessage, IFormatProvider?)

Writes a message of type TMessage to the output.

IMessageWriter? WriteMessage<TMessage>(TMessage message, IFormatProvider? formatProvider = null)

Parameters

message TMessage

The message to write.

formatProvider IFormatProvider

The format provider to apply, or null to use the current culture.

Returns

IMessageWriter

The registered writer that rendered the message, or null if none could handle it, indicating the caller should fall back to its own rendering. The writer is returned rather than a simple flag so the caller can consult WritesLineTerminator.

Type Parameters

TMessage

The type of the message to write.

Remarks

The writer is chosen by the type of message and receives that message unchanged, along with this processor, so that formatting stays the writer's responsibility. The caller's format provider travels with it, so a writer that renders a value honours the culture the caller asked for.