Click or drag to resize

LayoutTypedExtensionsRenderValueT Method

Renders the logevent into a result-value by using the provided layout

Namespace:  NLog
Assembly:  NLog (in NLog.dll) Version: 5.3.4+73d83d3161d31288ca5c554cc50d27b6bed5f28b
Syntax
public static T RenderValue<T>(
	this Layout<T> layout,
	LogEventInfo logEvent,
	T defaultValue = null
)

Parameters

layout
Type: NLog.LayoutsLayoutT
The layout.
logEvent
Type: NLogLogEventInfo
The logevent info.
defaultValue (Optional)
Type: T
Fallback value when no value available

Type Parameters

T

Return Value

Type: T
Result value when available, else fallback to defaultValue

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type LayoutT. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks
Inside a Target, RenderLogEvent(Layout, LogEventInfo) is preferred for performance reasons.
See Also