Dispose Pattern in C# презентация
Содержание
- 2. Agenda Destructor and Finalizer in C# IDisposable and RAII Dispose Pattern
- 3. Destructor and Finalizer in C#
- 4. Destructor in C# Destructor in C# language created with tilde (“~”)
- 5. Finalizer Problem Time of finalizer call is not defined in .NET,
- 6. IDisposable and RAII
- 7. Interface IDisposable Provides a mechanism for releasing unmanaged resources.
- 8. RAII Idiom RAII – Resource Acquisition Is Initialization RAII means that
- 9. Keyword using Keyword “using” not completely implements RAII
- 10. Method Dispose Dispose method differs from destructor in that way that
- 11. Dispose Pattern for Managed and Unmanaged Resources
- 12. Dispose Pattern Taking into account all previously mentioned, we have to
- 13. Managed and Unmanaged Resources Unmanaged resources – IntPtr, socket descriptors, any
- 14. Sample Resource Wrapper
- 15. Main Idea of Dispose Pattern The main idea of Dispose Pattern
- 16. 1. Interface Implementation Class that has both managed and unmanaged resources
- 17. 2. Method Dispose(bool disposing) Class contains method Dispose(bool disposing) that does
- 18. 3. Method Dispose() Dispose method implementation: first we call Dispose(true), then
- 19. Notes to GC.SupressFinalize() Call GC.SuppressFinalize() should be called after Dispose(true) but
- 20. 4. Parameter “disposing” Method Dispose(bool disposing) has two parts: If this method called
- 21. 5. Finalizer [OPTIONAL] Class may have finalizer and call Dispose(bool disposing) from
- 22. 6. Field “disposed” The good practice is to create special Boolean
- 23. Objects with Critical Finalization
- 24. 7. Object with Critical Finalization Class may be inherited from CriticalFinalizerObject:
- 25. Simplified Dispose Pattern
- 26. Simplifying Dispose Pattern Most difficulties with Dispose pattern implementation based on
- 27. Simplified Dispose Pattern Used only for managed resources
- 28. Recommended Links
- 29. Recommended Links Dispose pattern http://habrahabr.ru/post/129283/ IDisposable: What Your Mother Never Told
- 30. Скачать презентацию




















![5. Finalizer
[OPTIONAL] Class may have finalizer and call Dispose(bool disposing) from 5. Finalizer
[OPTIONAL] Class may have finalizer and call Dispose(bool disposing) from](/documents_3/fe1bf4523e445f63b201c5eff1485d8a/img20.jpg)








Слайды и текст этой презентации
Похожие презентации