What is lazy initialization
Lazy Initialization is a performance optimization where you defer the object creation until just before you actually need it.
When you have an object that is expensive to create and the program might not use it, you want to defer its creation until after other expensive operations have been completed. For example, assume that your program loads several object instances when it starts, but only some of them are required immediately. You can improve the startup performance of the program by deferring initialization (Lazy Initialization) of the objects that are not required until the required objects have been created. These objects are not initialized unless the user explicitly calls them.
Lazy initialization is primarily used to improve performance, avoid wasteful computation, and reduce program memory requirements. The advantages from an application perspective of lazy initialization are that users don't have to pay the initialization time for features they will not use. If you defer initializing some components until use time, your application will start up much quicker, that means, to defer the processing on something until you actually need it.
- Difference between NameSpace and Assembly
- Execution process for managed code
- What is an Asssembly Qualified Name
- How to Assembly versioning
- Add and remove an assembly from GAC
- What is Native Image Generator (Ngen.exe)?
- How to force Garbage Collection
- Difference between CType and DirectCast
- Obsolete or Deprecated in NET Framework
- Difference between Clone and Copy
- Difference between Finalize() and Dispose()
- Difference between static and constant