The point of this chapter was to demystify the garbage collection process. As you have seen, the garbage collector will only run when it is unable to acquire the necessary memory from the m- aged heap (or when a given AppDomain unloads from memory). When a garbage collection does occur, you can rest assured that Microsoft’s collection algorithm has been optimized by the use of object generations, secondary threads for the purpose of object finalization, and a managed heap dedicated to host large objects. This chapter also illustrated how to programmatically interact with the garbage collector using the System. GC class type. As mentioned, the only time when you will really need to do so is when you are building finalizable or disposable class types. Recall that finalizable types are classes that have overridden the virtual System. Object. Finalize() method to clean up unmanaged resources (at some time in the future). Disposable objects, on the other hand, are classes (or structures) that implement the IDisposable interface. Using this technique, you expose a public method to the object user that can be called to perform internal cleanup ASAP. Finally, you learned about an of- cial “disposal” pattern that blends both approaches. PART 3 Advanced VB Programming Constructs CHAPTER 9 Working with Interface Types This chapter builds on your current understanding of object-oriented development by examining the topic of interface-based programming.
Author(s): Andrew Troelsen (auth.)
Edition: 3
Publisher: Apress
Year: 2008
Language: English
Pages: 1377
Tags: Programming Techniques
Front Matter....Pages i-xxx
Front Matter....Pages 1-1
The Philosophy of .NET....Pages 3-33
Building Visual Basic 2008 Applications....Pages 35-61
Front Matter....Pages 63-63
VB 2008 Programming Constructs, Part I....Pages 65-102
VB 2008 Programming Constructs, Part II....Pages 103-128
Designing Encapsulated Class Types....Pages 129-171
Understanding Inheritance and Polymorphism....Pages 173-206
Understanding Structured Exception Handling....Pages 207-231
Understanding Object Lifetime....Pages 233-251
Front Matter....Pages 253-253
Working with Interface Types....Pages 255-289
Collections, Generics, and Nullable Data Types....Pages 291-326
Delegates, Events, and Lambdas....Pages 327-358
Operator Overloading and Custom Conversion Routines....Pages 359-381
VB 2008-Specific Language Features....Pages 383-408
An Introduction to LINQ....Pages 409-433
Front Matter....Pages 435-435
Introducing .NET Assemblies....Pages 437-481
Type Reflection, Late Binding, and Attribute-Based Programming....Pages 483-516
Processes, AppDomains, and Object Contexts....Pages 517-536
Building Multithreaded Applications....Pages 537-569
.NET Interoperability Assemblies....Pages 571-603
Front Matter....Pages 605-605
File and Directory Manipulation....Pages 607-632
Front Matter....Pages 605-605
Introducing Object Serialization....Pages 633-651
ADO.NET Part I: The Connected Layer....Pages 653-703
ADO.NET Part II: The Disconnected Layer....Pages 705-757
Programming with the LINQ APIs....Pages 759-794
Introducing Windows Communication Foundation....Pages 795-841
Introducing Windows Workflow Foundation....Pages 843-880
Front Matter....Pages 881-881
Introducing Windows Forms....Pages 883-927
Rendering Graphical Data with GDI+....Pages 929-981
Programming with Windows Forms Controls....Pages 983-1043
Front Matter....Pages 1045-1045
Introducing Windows Presentation Foundation and XAML....Pages 1047-1101
Programming with WPF Controls....Pages 1103-1165
WPF 2D Graphical Rendering, Resources, and Themes....Pages 1167-1211
Front Matter....Pages 1213-1213
Building ASP.NET Web Pages....Pages 1215-1259
ASP.NET Web Controls, Themes, and Master Pages....Pages 1261-1295
ASP.NET State Management Techniques....Pages 1297-1330
Back Matter....Pages 1331-1377