ReflectionServiceGetClassForClassInstanceByAttribute(Type, Type, Object) 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.ServicesAssembly: AltaxoBase (in AltaxoBase.dll) Version: 4.8.3179.0 (4.8.3179.0)
Syntax public static Object? GetClassForClassInstanceByAttribute(
Type attributeType,
Type[] expectedTypes,
Object[] creationArgs
)
Parameters
- attributeType Type
- The type of attribute the class(es) to instantiate must be assigned to.
- expectedTypes Type
- The expected type(s) of return value.
- creationArgs Object
- The creation arguments used to instantiate a class.
Return Value
ObjectThe 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