Table of Contents

Class RpcMarshalableOptionalInterfaceAttribute

Namespace
StreamJsonRpc
Assembly
StreamJsonRpc.dll

Attribute to be used on an interface marked with RpcMarshalableAttribute to indicate that the marshalable object may also implement the interface OptionalInterface.

[AttributeUsage(AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
public class RpcMarshalableOptionalInterfaceAttribute : Attribute
Inheritance
RpcMarshalableOptionalInterfaceAttribute
Inherited Members

Remarks

When an object that implements OptionalInterface is marshaled as its base interface marked with RpcMarshalableOptionalInterfaceAttribute, OptionalInterfaceCode is included in the StreamJsonRpc message allowing the creation of a proxy which also implements OptionalInterface.

If a message is received containing no OptionalInterfaceCode values, for a marshalable interface that has known optional interfaces, a proxy will be created using the base interface. Unknown OptionalInterfaceCode values will be ignored when creating the proxy.

RpcMarshalableOptionalInterfaceAttribute is honored only when an object is marshaled through an RPC method that used exactly the interface the attribute is assigned to: RpcMarshalableOptionalInterfaceAttribute attributes applied to interfaces extending or extended from the one the attribute is assigned to are ignored.

Constructors

RpcMarshalableOptionalInterfaceAttribute(int, Type)

Initializes a new instance of the RpcMarshalableOptionalInterfaceAttribute class.

public RpcMarshalableOptionalInterfaceAttribute(int optionalInterfaceCode, Type optionalInterface)

Parameters

optionalInterfaceCode int

The code to be serialized to specify that the marshaled object proxy should be generated implementing the optionalInterface interface. optionalInterfaceCode values must be unique across the different optional interfaces of the type this attribute is applied to. Because optionalInterfaceCode is serialized when transmitting a marshaled object, its value should never be reassigned to a different optional interface when updating RPC interfaces.

optionalInterface Type

The Type of the known optional interface that the marshalable object may implement.

Properties

OptionalInterface

Gets the Type of the known optional interface that the marshalable object may implement.

public Type OptionalInterface { get; }

Property Value

Type

OptionalInterfaceCode

Gets the code to be serialized to specify that the marshaled object proxy should be generated implementing the OptionalInterface interface.

public int OptionalInterfaceCode { get; }

Property Value

int