PostSharp6.3/API Reference/Post­Sharp.​Patterns.​Formatters Namespace/Formatter­Repository(TRole) Class

FormatterRepository<TRole> Class

Allows to get and register formatters for a specific type.
Inheritance Hierarchy

Namespace:  PostSharp.Patterns.Formatters
Assembly:  PostSharp.Patterns.Common (in PostSharp.Patterns.Common.dll) Version: 6.3.11.0 (6.3.11.0)
Syntax
C#
public abstract class FormatterRepository<TRole>
where TRole : new(), FormattingRole

Type Parameters

TRole
Marker type used to differentiate FormattingServices for different purposes (e.g. caching or logging).

The FormatterRepository<TRole> type exposes the following members.

Constructors
  NameDescription
Protected methodFormatterRepository<TRole>
Initializes a new FormatterRepository<TRole>.
Methods
  NameDescription
Public methodStatic memberGet(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.
Public methodStatic memberGet<T>()
Returns the formatter for the type T.
Public methodStatic memberRegister(Type, IFormatter)
Registers the given formatter for the given targetType.
Public methodStatic memberCode exampleRegister(Type, Type)
Registers the given formatterType for the given targetType.
Public methodStatic memberRegister<T>(IFormatter<T>)
Registers the given formatter for the type T.
Public methodStatic memberReset
Clears formatters, but doesn't reset registrations.
Public methodStatic memberSetDynamic<T>
Requests that formatters for parameters of a given type will be resolved according to the type of the parameter value, not to the type of the parameter itself.
See Also