O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use the Registry Pattern

Problem

You need a convenient way to track objects and retrieve them by name from multiple places in your code.

Solution

Use the registry pattern, which centralizes access to a set of objects through one registry object.

Discussion

A registry object acts as a repository for a collection of items that you need to identify and retrieve later. For example, you might use a registry to track all the currently loaded forms in a Microsoft Windows application. The .NET Framework does not provide any built-in method to offer this functionality.

First of all, you need to create your registry object. Clients register and unregister elements in the registry, giving them convenient names for later retrieval. The registry object shown here ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required