Table of Contents

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

service IServiceCollection

The service collection to add the formatter to.

Returns

IServiceCollection

The same service collection instance to enable method chaining.

Type Parameters

TMessageType

The type of message that the formatter can format.

TFormatter

The 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.