Lazy is another programming pattern that is used by application developers to improve application performance. Laziness is about delaying computation until it's actually needed. In a best-case scenario, the computation might not be needed at all, which helps in not wasting compute resources and thus improving the performance of the system as a whole. Lazy evaluation is not new to computing, and LINQ uses lazy loading heavily. LINQ follows the deferred execution model in which queries are not executed until we call MoveNext() on them using some iterator functions.
The following is an example of a thread-safe lazy singleton pattern that utilizes some heavy compute operations for creation and is thus deferred:
public class LazySingleton<T> where T : class
{
static object _syncObj = new object();
static T _value;
private LazySingleton...