Allows getting and registering formatters for a specific type.
Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common.dll
Syntax
public abstract class FormatterRepository<TRole> where TRole : FormattingRole, new()Type Parameters
| Name | Description |
|---|---|
| TRole | The marker type used to differentiate FormattingServices for different purposes, such as caching or logging. |
Constructors
| Name | Description |
|---|---|
| FormatterRepository() | Initializes a new instance of the FormatterRepository<TRole> class. |
Methods
| Name | Description |
|---|---|
| Get(Type) | Returns a formatter for a specific object. This overload should be used when the type of the object is not known at build time because the type is non-sealed. |
| Get<T>() | Returns the formatter for the type |
| Register(Type, IFormatter) | Registers the given |
| Register(Type, Type) | Registers the given |
| Register<T>(IFormatter<T>) | Registers the given |
| Reset() | Clears the formatters, but does not reset the registrations. |
| SetDynamic<T>() | Specifies that formatters for parameters of a given type are resolved according to the type of the parameter value, not the type of the parameter itself. Interfaces, abstract classes, and the object class are always resolved dynamically. |