Ferrous API Reference

All Types / Ferrous.Concurrency

class LazyLock<T>

public sealed class LazyLock<T>

A thread-safe lazily initialized value inspired by Rust's std::sync::LazyLock<T>. Safe to store in static readonly fields without triggering FE0501.

Type Parameters
T
The stored value type.

Constructors

public LazyLock(Func<T> factory)

Initializes a new LazyLock<T> with the given factory.

Properties

public bool IsInitialized

Gets a value indicating whether the value has been initialized.

public T Value

Gets the lazily initialized value.