A solid understanding of object end-of-lifecycle handling is necessary for achieving efficient memory use in .NET. Unfortunately, the official documentation on the topic is somewhat fragmented and targeted at developers from historically relevant backgrounds, leaving an increasingly large proportion of new .NET developers to flounder in some rather murky waters. This session will examine how to best design for object end-of-lifecycle in .NET, including such concerns as: Why do we have both finalizers and IDisposable? How are they meant to interact? When should you implement a finalizer? (Probably much less often than you might think!) When should you implement IDisposable? What are the recommended implementation patterns for both finalization and disposition? What are the recommended patterns for consumption of disposable objects? |