Metalama 1.0 / / Metalama Documentation / Extensions API / Metalama.​Extensions.​Dependency­Injection.​Implementation / Default­Dependency­Injection­Strategy / Try­Introduce­Field­Or­Property

Method TryIntroduceFieldOrProperty

TryIntroduceFieldOrProperty(IAspectBuilder<INamedType>, out IFieldOrProperty)

Introduces the field or property into the target class.

Declaration
protected virtual bool TryIntroduceFieldOrProperty(IAspectBuilder<INamedType> builder, out IFieldOrProperty introducedFieldOrProperty)
Parameters
Type Name Description
IAspectBuilder<INamedType> builder

An IAspectBuilder<TAspectTarget> for the target class.

IFieldOrProperty introducedFieldOrProperty

At output, the created field or property.

Returns
Type Description
Boolean

true if the dependency was introduced, false if the dependency was ignored (for instance because it already existed) or in case or error.