Compartilhar via


Using Generic Types With .NET Framework Remoting

This topic is specific to a legacy technology that is retained for backward compatibility with existing applications and is not recommended for new development. Distributed applications should now be developed using the Windows Communication Foundation (WCF).

.NET remoting supports the use of generic types in distributed applications that use binary serialization. (SOAP serialization of generic types is not supported.) Generic types that follow requirements for proper serialization support are described in Automatic Deserialization in .NET Framework Remoting.

For an example of implementing a generic interface, see Remoting Generics Technology Sample.

When you specify generic types in configuration files, you must use two sets of square brackets ("[]") to indicate all of the nested type arguments when you are indicating the type parameters. For a full example illustrating this, see Using Generics in Remoting Through Configuration.

Specifying Generic Remote Types

The following code example demonstrates how to specify a generic remote type in a configuration file.

<service>
  <wellknown mode="Singleton" type="GenericServer`1[[System.String,mscorlib]], GenericServer" objectUri="genSvr.rem" />
</service> 

See Also

Concepts

Automatic Deserialization in .NET Framework Remoting