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
messageTMessageThe message to write.
formatProviderIFormatProviderThe 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
TMessageThe 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.