Method AddMessageFormatter
- Namespace
- Ploch.CommandLine.Spectre.Output
- Assembly
- Ploch.CommandLine.Spectre.dll
AddMessageFormatter<TMessageType, TFormatter>(IServiceCollection)
Registers a message formatter for a specific message type in the service collection.
public static IServiceCollection AddMessageFormatter<TMessageType, TFormatter>(this IServiceCollection service) where TFormatter : class, IMessageFormatter<TMessageType>
Parameters
serviceIServiceCollectionThe service collection to add the formatter to.
Returns
- IServiceCollection
The same service collection instance to enable method chaining.
Type Parameters
TMessageTypeThe type of message that the formatter can format.
TFormatterThe type of the formatter implementation.
Remarks
A formatter registered for a type that already has one replaces it for that exact type; see the class remarks.