Table of Contents

Interface IActivator

Namespace
ZeroC.Slice
Assembly
ZeroC.Slice.dll

Provides methods that create class and exception instances from Slice type IDs.

public interface IActivator

Remarks

When decoding a Slice1-encoded buffer, a Slice decoder uses its activator to create a class or exception instance before decoding the instance's fields.

Methods

CreateClassInstance(string)

Creates an instance of a Slice class based on a type ID.

object? CreateClassInstance(string typeId)

Parameters

typeId string

The Slice type ID.

Returns

object

A new instance of the class identified by typeId, or null if the implementation cannot find the corresponding class..

Remarks

This implementation of this method can also throw an exception if the class is found but the activation of an instance fails.

CreateExceptionInstance(string, string?)

Creates an instance of a Slice exception based on a type ID.

object? CreateExceptionInstance(string typeId, string? message)

Parameters

typeId string

The Slice type ID.

message string

The exception message.

Returns

object

A new instance of the class identified by typeId, or null if the implementation cannot find the corresponding class..

Remarks

This implementation of this method can also throw an exception if the class is found but the activation of an instance fails.

FromAssemblies(params Assembly[])

Gets or creates an activator for the Slice types defined in the specified assemblies and their referenced assemblies.

public static IActivator FromAssemblies(params Assembly[] assemblies)

Parameters

assemblies Assembly[]

The assemblies.

Returns

IActivator

An activator that activates the Slice types defined in assemblies and their referenced assemblies. See FromAssembly(Assembly).

FromAssembly(Assembly)

Gets or creates an activator for the Slice types in the specified assembly and its referenced assemblies.

public static IActivator FromAssembly(Assembly assembly)

Parameters

assembly Assembly

The assembly.

Returns

IActivator

An activator that activates the Slice types defined in assembly provided this assembly contains generated code (as determined by the presence of the SliceAttribute attribute). The Slice types defined in assemblies referenced by assembly are included as well, recursively. If a referenced assembly contains no generated code, the assemblies it references are not examined.

See Also