Interface IActivator
Provides methods that create class and exception instances from Ice type IDs.
public interface IActivator
Remarks
When decoding a buffer, an Ice decoder uses its activator to create a class or exception instance before decoding the instance's fields.
Methods
CreateInstance(string)
Creates an instance of an Ice class or Ice exception based on a type ID.
object? CreateInstance(string typeId)
Parameters
typeIdstringThe Ice type ID.
Returns
- object
A new instance of the class identified by
typeId, or null if the implementation cannot find the corresponding C# 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 Ice types defined in the specified assemblies and their referenced assemblies.
public static IActivator FromAssemblies(params Assembly[] assemblies)
Parameters
assembliesAssembly[]The assemblies.
Returns
- IActivator
An activator that activates the Ice types defined in
assembliesand their referenced assemblies. See FromAssembly(Assembly).
FromAssembly(Assembly)
Gets or creates an activator for the Ice types in the specified assembly and its referenced assemblies.
public static IActivator FromAssembly(Assembly assembly)
Parameters
assemblyAssemblyThe assembly.
Returns
- IActivator
An activator that activates the Ice types defined in
assemblyprovided this assembly contains generated code (as determined by the presence of the IceGeneratedCodeAttribute attribute). The Ice types defined in assemblies referenced byassemblyare included as well, recursively. If a referenced assembly contains no generated code, the assemblies it references are not examined.