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.5.0+1873145cbc26e0312d9481234d69ce7dc68aac4e
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