Class RpcTargetMetadata.ClassAndInterfaces
- Namespace
- StreamJsonRpc
- Assembly
- StreamJsonRpc.dll
Represents a collection of interfaces implemented by a specified class type for use as an RPC target.
public class RpcTargetMetadata.ClassAndInterfaces
- Inheritance
-
RpcTargetMetadata.ClassAndInterfaces
- Inherited Members
Remarks
Use this class to track and manage the interfaces that a given class type implements, typically for remote procedure call (RPC) scenarios. Interfaces must be added explicitly after construction using the Add method, unless the Create factory method is used to automatically populate the collection.
Constructors
ClassAndInterfaces(Type)
Initializes a new instance of the RpcTargetMetadata.ClassAndInterfaces class.
public ClassAndInterfaces(Type classType)
Parameters
classTypeTypeThe class type serving as the RPC target.
Remarks
After construction, all interfaces that the classType implements
must be added using the Add(Type) method.
Use the Create(Type) factory method to automate full initialization of this collection, at the cost of a less trimmable application.
Methods
Add(Type)
Adds an interface to the set of interfaces supported by the RPC target.
public void Add(Type iface)
Parameters
ifaceTypeThe interface type to add. Must be an interface implemented by the target class.
Create(Type)
Creates a new instance of the RpcTargetMetadata.ClassAndInterfaces class that represents the specified class type and all of its implemented interfaces.
[SuppressMessage("Trimming", "IL2072:Target parameter argument does not satisfy 'DynamicallyAccessedMembersAttribute' in call to target method. The return value of the source method does not have matching annotations.", Justification = "We use the All link demand on rpcContract, so results of GetInterfaces() should work. See https://github.com/dotnet/linker/issues/1731")]
public static RpcTargetMetadata.ClassAndInterfaces Create(Type classType)
Parameters
classTypeTypeThe Type object representing the class to include, along with all interfaces implemented by the class. Must not be null.
Returns
- RpcTargetMetadata.ClassAndInterfaces
A RpcTargetMetadata.ClassAndInterfaces instance containing the specified class type and all interfaces it implements.