Working with Class Objects

The .NET Framework is entirely object-oriented. There are some points worth reinforcing about working with class objects within the .NET Framework, chiefly object construction and destruction, how callbacks work, and using delegates and events.

Constructors and Finalizers

In most cases, you create objects by creating new instances of a class using the new keyword, and you do not explicitly delete those objects. Instead, you rely on the .NET Compact Framework garbage collector to detect when the object becomes unreferenced and to delete the unreferenced object, freeing up memory. An object becomes unreferenced when no other classes or applications need the object. Consider the following C# example:

Public void MyMethod() ...

Get Microsoft® .NET Compact Framework (Core Reference) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.