Intermediate C#
Q75 / 100

What is a Lazy<T> in C#?

Correct! Well done.

Incorrect.

The correct answer is B) A thread-safe wrapper that initializes its value on first access using a factory function

B

Correct Answer

A thread-safe wrapper that initializes its value on first access using a factory function

Explanation

Lazy<HeavyObject> obj = new(() => new HeavyObject()); obj.Value triggers initialization on first access. Thread-safe by default.

Progress
75/100