Получи случайную криптовалюту за регистрацию!

What is the best practice to have best performance using Lazy | C# 1001 notes

What is the best practice to have best performance using Lazy objects?

You typically use it when you want to instantiate something the first time its actually used. This delays the cost of creating it till if/when it's needed instead of always incurring the cost.

Usually this is preferable when the object may or may not be used and the cost of constructing it is non-trivial.

For example Lazy makes implementing lazy, thread-safe singletons easy.