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

Register All the Remotable Classes in an Assembly

Problem

You want to register all the remotable classes that are defined in an assembly without having to specify them in a configuration file.

Solution

Load the assembly with the remotable classes using reflection. Loop through all its types, and use the RemotingConfiguration.RegisterWellKnownServiceType to register every remotable class.

Discussion

.NET makes it equally easy to register remotable classes through a configuration file or programmatically with code. For example, consider the example from recipe Make an Object Remotable. To use programmatic registration, you would first remove the class declarations from the configuration file and leave it as shown here:

<configuration> <system.runtime.remoting> ...

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