Method GetMessageText
- Namespace
- Ploch.CommandLine.Spectre.Output
- Assembly
- Ploch.CommandLine.Spectre.dll
GetMessageText(FormattableString?, string?, IFormatProvider?)
Formats a message as a FormattableString with optional markup.
FormattableString GetMessageText(FormattableString? message, string? markupTag = null, IFormatProvider? formatProvider = null)
Parameters
messageFormattableStringThe message to format, or
null.markupTagstringOptional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).
formatProviderIFormatProviderThe format provider forwarded to the formatter selected for each interpolated argument, or null to use the current culture. A FormattableString cannot carry a provider, so a caller that materialises the result must supply the provider again at that point.
Returns
- FormattableString
A formatted string with applied markup, or an empty string if the input is null.
GetMessageText<TMessage>(TMessage?, string?, IFormatProvider?)
Formats a message of type TMessage with optional markup.
string? GetMessageText<TMessage>(TMessage? message, string? markupTag = null, IFormatProvider? formatProvider = null)
Parameters
messageTMessageThe message to format, or
null.markupTagstringOptional markup tag to apply to the message (e.g., "b" for bold, "i" for italic).
formatProviderIFormatProviderThe format provider to apply, or null to use the current culture.
Returns
- string
A formatted string with applied markup, or
nullif the input is null.
Type Parameters
TMessageThe type of the message to format.