RE: RE: Lazy Initialization in C#
You are viewing a single comment's thread from:

RE: Lazy Initialization in C#

RE: Lazy Initialization in C#

Lazy initialization is only required for resource intensive objects. A list is not. Maybe the elements it contains. A list autoscales. It starts with room reserved for little references. If it needs more room it reserves more space.

It is also worth mentioning that your example is not thread safe. It's better to refer to the Lazy<T> Class:
https://msdn.microsoft.com/en-us/library/dd642331.aspx

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center