Skip to content
Concord

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

method string

The target method name. Private names are validated by Concord tooling.

constructedType Type

The type whose construction the injection targets.

shift At

Where the injection method runs relative to the construction.

by uint

The 1-based occurrence to target, or 0 for every match.

targetParameterTypes Type[]

Selects one overload of method by parameter types.

invokeParameterTypes Type[]

Restricts matches to one constructor overload by parameter types.

arg uint

For Argument, the 1-based argument to rewrite, or 0 to 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

constructedType Type

The type whose construction the injection targets.

shift At

Where the injection method runs relative to the construction.

by uint

The 1-based occurrence to target, or 0 for every match.

targetParameterTypes Type[]

The parameter types of the target constructor overload.

invokeParameterTypes Type[]

Restricts matches to one constructor overload by parameter types.

arg uint

For Argument, the 1-based argument to rewrite, or 0 to infer by unique type match.

Properties

At

The injection position supplied to the declaration.

public At At { get; }

Property Value

At

Body

Which body this injection attaches to when the target is an async or iterator method.

public PatchBody Body { get; set; }

Property Value

PatchBody

ConstructedType

The type whose construction the injection targets.

public Type ConstructedType { get; }

Property Value

Type

Method

The target method name this injection attaches to, or null when TargetsConstructor is true.

public string? Method { get; }

Property Value

string

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

int

TargetsConstructor

Whether this injection targets the declaring base type's instance constructor.

public bool TargetsConstructor { get; }

Property Value

bool