Click or drag to resize

ReflectionServiceCreateInstanceFromList Method

Tries to get a class instance for a given attribute type. All loaded assemblies are searched for classes that attributeType applies to, then for all found classes the instantiation of a class is tried, until a instance is created successfully. Here, the attributeType has to implement IClassForClassAttribute, and creationArg[0] has to match the type in TargetType

Namespace: Altaxo.Main.Services
Assembly: AltaxoBase (in AltaxoBase.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax
C#
public static Object? CreateInstanceFromList(
	ReflectionServiceIAttributeForClassList list,
	Type[] expectedTypes,
	Object[] creationArgs
)

Parameters

list  ReflectionServiceIAttributeForClassList
The list of types to try for creation.
expectedTypes  Type
The expected types of return value.
creationArgs  Object
The creation arguments used to instantiate a class.

Return Value

Object
The instance of the first class for which the instantiation was successfull and results in the expectedType. Otherwise null.
Remarks
The instantiation is tried first with the full argument list. If that fails, the last element of the argument list is chopped and the instantiation is tried again. This process is repeated until the instantiation was successfull or the argument list is empty (empty constructor is tried at last).
See Also