Share via


WeakDelegates Sample

This sample demonstrates the following:

  • Using the Micro Framework’s WeakDelegate class to notify the object of events. A WeakDelegate allows the object to have its memory reclaimed as long as the application has no other references to the object (forcing it to stay alive).
  • Defining an event that uses WeakDelegate objects to refer to the objects that have registered interest in the event.
  • Creating an object and registering it with an event supporting WeakDelegates.
  • How a strong reference to the object ensures that it receives notification when the event is raised.
  • How no strong references to the object allows a garbage collection to destroy the object. Consequently, the object will not receive any further notifications when the event is raised.

For information about running and exploring this sample, see the Readme.txt file in the directory under:

Documents\Microsoft .NET Micro Framework 4.1\Samples\