Chapter 8. Managing an Object’s Lifetime

Real life is often a great place to get programming examples. Think of life: Humans are born; they grow up; they live their lives; they do tons of things; and, at a certain point of life, they die. Managing objects in programming environments works similarly. You give life to an object by creating an instance; then you use it in your own application while it is effectively useful to the application. But there is a point at which you do not need an object anymore, so you need to destroy it to free up memory and other resources, bringing an object to “death.” Understanding how object lifetime works in .NET programming is fundamental because it gives you the ability to write better code; code that can take advantage of system resources to consume resources the appropriate way or return unused resources to the system.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.189.31.26