Init(args)
Scripting Reference
Loading...
Searching...
No Matches

◆ GetConstructorArgumentTargetFieldName()

static string Sisus.Init.Reflection.InjectionUtility.GetConstructorArgumentTargetFieldName ( [DisallowNull] Type classType,
[DisallowNull] Type parameterType )
static

Gets the name of the field or property into which the parameter constructor argument accepted by the object of type classType is assigned to in the constructor of the object.

Uses reflection to figure out the name by searching for a field or property with their name closely matching that of the parameter , or failing that, their type matching the type of the parameter exactly.

Parameters
classTypeType of the class containing the field.
parameterTypeThe type of the constructor parameter.
Returns
The name of an instance field or property matching the parameter .
Exceptions
MissingMemberExceptionThrown if no field or property is found with their name closely matching that of the parameter or their type matching the type of the parameter exactly.
AmbiguousMatchExceptionThrown if no field or property is found with their name closely matching that of the parameter , and more than one field or property is found with their type matching the type of the parameter exactly.