Table of Contents

Delegate TokenHandler<T>

Namespace
Microsoft.Practices.EnterpriseLibrary.Logging.Formatters
Assembly
Microsoft.Practices.EnterpriseLibrary.Logging.dll

Transforms a token definition from a string template into a Formatter<T>.

public delegate Formatter<T> TokenHandler<T>(string template, ref int currentIndex)

Parameters

template string

The template being parsed.

currentIndex int

The current index in the template.

Returns

Formatter<T>

The Formatter<T> representing the token, or null if the parsing of the token was not successful.

Type Parameters

T

The type to format.

Remarks

A token handler gets control of the template parsing process right after the token name has been consumed, and consumes the rest of the token definition advancing the currentIndex pointer to the end of the token.

If the text following the token name cannot be parsed into the expected token, the currentIndex should still be updated and null should be returned.

Constructors

TokenHandler(object, nint)

public TokenHandler(object @object, nint method)

Parameters

object object
method nint

Methods

BeginInvoke(string, ref int, AsyncCallback, object)

public virtual IAsyncResult BeginInvoke(string template, ref int currentIndex, AsyncCallback callback, object @object)

Parameters

template string
currentIndex int
callback AsyncCallback
object object

Returns

IAsyncResult

EndInvoke(ref int, IAsyncResult)

public virtual Formatter<T> EndInvoke(ref int currentIndex, IAsyncResult result)

Parameters

currentIndex int
result IAsyncResult

Returns

Formatter<T>

Invoke(string, ref int)

public virtual Formatter<T> Invoke(string template, ref int currentIndex)

Parameters

template string
currentIndex int

Returns

Formatter<T>