Open sandboxFocus

Method Create

Create(object?, LogEventMetadata?)

Creates a new LogEventData and specifies a LogEventMetadata.

Declaration
public static LogEventData Create(object? data, LogEventMetadata? metadata)
Parameters
Type Name Description
object data

The raw CLR object, typically an instance of anonymous type or any other type.

LogEventMetadata metadata

The LogEventMetadata used to interpret data. When this parameter is null, the default LogEventMetadata implementation is used, which maps CLR properties into logging properties.

Returns
Type Description
LogEventData

Create(object?)

Creates a new LogEventData and uses the default LogEventMetadata for the run-time type of the specified object.

Declaration
public static LogEventData Create(object? data)
Parameters
Type Name Description
object data

The raw CLR object, typically an instance of anonymous type or any other type.

Returns
Type Description
LogEventData

Create<T>(T?)

Creates a new LogEventData and uses the default LogEventMetadata for the build-time type of the specified object. This overload is faster than the non-generic one.

Declaration
public static LogEventData Create<T>(T? data)
Parameters
Type Name Description
T data

The raw CLR object, typically an instance of anonymous type or any other type.

Returns
Type Description
LogEventData
Type Parameters
Name Description
T