Examples from Chapter 7 (Object Lifetime) of Programming C# 12.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. Emulating fixed-size arrays before C# 12.0
- Example 7. A fixed-sized inline array type
- Example 8. A fixed-sized inline array type
- Example 9. Enabling server GC in a project file
- Example 11. The IDisposable interface
- Example 12. A using statement
- Example 13. How using statements expand
- Example 14. A using declaration
- Example 15. Stacking using statements
- Example 16. A foreach loop
- Example 17. How foreach loops expand
- Example 18. Disposing a contained instance
- Example 19. Custom finalization and disposal logic