Table of Contents

Class LazyGetAndLog<TValue>

Namespace
ToSic.Sys
Assembly
ToSic.Sys.Core.dll

A LazyGet<TValue> with logging.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public class LazyGetAndLog<TValue>

Type Parameters

TValue
Inheritance
object
LazyGetAndLog<TValue>

Fields

Value

protected TValue? Value

Field Value

TValue

Properties

IsValueCreated

Determines if value has been created. The name IsValueCreated is the same as in a Lazy() object

public bool IsValueCreated { get; protected set; }

Property Value

bool

Methods

Get(ILog, Func<TValue>, bool, bool, string?, string?, string?, string?, int)

Getter with will log its actions when it retrieves the property the first time.

public TValue? Get(ILog log, Func<TValue> generator, bool timer = false, bool enabled = true, string? parameters = null, string? message = null, string? cPath = null, string? cName = null, int cLine = 0)

Parameters

log ILog

Log object to use when logging

generator Func<TValue>

Function which will generate the value on first use. The function must return the expected value/type.

timer bool

enable a timer from call/close

enabled bool

can be set to false if you want to disable logging

parameters string
message string
cPath string

auto pre-filled by the compiler - the path to the code file

cName string

auto pre-filled by the compiler - the method name

cLine int

auto pre-filled by the compiler - the code line

Returns

TValue