Open sandboxFocus

Class Formatter<T>

Base implementation of the IFormatter<T> interface.

Namespace: PostSharp.Patterns.Formatters
Assembly: PostSharp.Patterns.Common.dll
Syntax
public abstract class Formatter<T> : IFormatter<T>, IOptionAwareFormatter, IFormatter
Type Parameters
Name Description
T

The type of values that can be formatted.

Remarks

Derive a class from Formatter<T> to customize how values of a type that you do not own are represented in logs or cache keys. For a type that you own, implementing IFormattable is simpler. Unlike an IFormattable implementation, a formatter is used only after it has been registered, for instance with Register<T>(IFormatter<T>). Logging and caching have separate formatter repositories, so a formatter must be registered with each component that should use it.

Constructors

Name Description
Formatter()

Properties

Name Description
Attributes

Gets the formatter attributes.

Methods

Name Description
WithOptions(FormattingOptions)
Write(UnsafeStringBuilder, object)

Appends the description of an object into the given UnsafeStringBuilder (weakly-typed variant).

Write(UnsafeStringBuilder, T)

Appends the description of an object into the given UnsafeStringBuilder (weakly-typed variant).

Extension Methods

See Also