Examples from Chapter 7 (Object Lifetime) of Programming C# 8.0 (O'Reilly).
- Example 1. Using and discarding objects
- Example 2. An appallingly inefficient piece of code
- Example 3. Using weak references in a cache
- Example 4. Exercising the weak cache
- Example 5. A small object with a large array
- Example 6. Enabling server GC in a .NET Core application project file
- Example 7. Legacy server GC configuration (for .NET Framework)
- Example 9. The IDisposable interface
- Example 10. A using statement
- Example 11. How using statements expand
- Example 12. A using declaration
- Example 13. Stacking using statements
- Example 14. A foreach loop
- Example 15. How foreach loops expand
- Example 16. Disposing a contained instance
- Example 17. Custom finalization and disposal logic