Class InjectNewAttribute
- Namespace
- Concord
- Assembly
- Concord.Emit.dll
Marks an injection method as targeting an object construction inside a target method.
[AttributeUsage(AttributeTargets.Method)]
public sealed class InjectNewAttribute : Attribute
- Inheritance
-
InjectNewAttribute
- Inherited Members
Constructors
InjectNewAttribute(string, Type, At, uint, Type[]?, Type[]?, uint)
Initializes a new construction-site injection declaration on a named target method.
public InjectNewAttribute(string method, Type constructedType, At shift, uint by = 0, Type[]? targetParameterTypes = null, Type[]? invokeParameterTypes = null, uint arg = 0)
Parameters
methodstringThe target method name. Private names are validated by Concord tooling.
constructedTypeTypeThe type whose construction the injection targets.
shiftAtWhere the injection method runs relative to the construction.
byuintThe 1-based occurrence to target, or
0for every match.targetParameterTypesType[]Selects one overload of
methodby parameter types.invokeParameterTypesType[]Restricts matches to one constructor overload by parameter types.
arguintFor Argument, the 1-based argument to rewrite, or
0to infer by unique type match.
InjectNewAttribute(Type, At, uint, Type[]?, Type[]?, uint)
Initializes a new construction-site injection declaration on the patch target's instance constructor.
public InjectNewAttribute(Type constructedType, At shift, uint by = 0, Type[]? targetParameterTypes = null, Type[]? invokeParameterTypes = null, uint arg = 0)
Parameters
constructedTypeTypeThe type whose construction the injection targets.
shiftAtWhere the injection method runs relative to the construction.
byuintThe 1-based occurrence to target, or
0for every match.targetParameterTypesType[]The parameter types of the target constructor overload.
invokeParameterTypesType[]Restricts matches to one constructor overload by parameter types.
arguintFor Argument, the 1-based argument to rewrite, or
0to infer by unique type match.
Properties
At
The injection position supplied to the declaration.
public At At { get; }
Property Value
Body
Which body this injection attaches to when the target is an async or iterator method.
public PatchBody Body { get; set; }
Property Value
ConstructedType
The type whose construction the injection targets.
public Type ConstructedType { get; }
Property Value
Method
The target method name this injection attaches to, or null when TargetsConstructor is true.
public string? Method { get; }
Property Value
ParameterTypes
The parameter types used to disambiguate the target method or constructor overload.
public Type[]? ParameterTypes { get; }
Property Value
- Type[]
Priority
The ordering priority for this injection when several target the same method.
public int Priority { get; set; }
Property Value
TargetsConstructor
Whether this injection targets the declaring base type's instance constructor.
public bool TargetsConstructor { get; }