Keep it simple...
Tuesday, March 12, 2019
Lazy initialization in C#
Lazy<T> can be used in C# to delay the initialization of an object. It can be used in singleton architecture as given in the below example.
public static Lazy<MyClass> MyClassInstance = new Lazy<MyClass>(()=> new MyClass());
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment