MetalamaAPI documentationAspect APIMetalama.​Framework.​AdvisingIAdvice­FactoryIntroduce­Automatic­Property
Open sandboxFocus

IAdviceFactory.IntroduceAutomaticProperty Method

IntroduceAutomaticProperty(INamedType, String, Type, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>, Object)

Introduces an auto-implemented property to the target type by specifying a property name and System.Type.

Declaration
IIntroductionAdviceResult<IProperty> IntroduceAutomaticProperty(INamedType targetType, string propertyName, Type propertyType, IntroductionScope scope, OverrideStrategy whenExists, Action<IPropertyBuilder> buildProperty = null, object tags = null)
Parameters
Type Name Description
INamedType targetType

The type into which the property must be introduced.

System.String propertyName

Name of the introduced field.

System.Type propertyType

Type of the introduced field.

IntroductionScope scope

Determines the scope (e.g. Instance or Static) of the introduced field. The default scope is Instance.

OverrideStrategy whenExists

Determines the implementation strategy when a property of the same name is already declared in the target type. The default strategy is to fail with a compile-time error.

System.Action<IPropertyBuilder> buildProperty
System.Object tags
Returns
Type Description
IIntroductionAdviceResult<IProperty>

An IPropertyBuilder that allows to dynamically change the name or type of the introduced property.

See Also

IntroduceAutomaticProperty(INamedType, String, IType, IntroductionScope, OverrideStrategy, Action<IPropertyBuilder>, Object)

Introduces an auto-implemented property to the target type by specifying a property name and IType.

Declaration
IIntroductionAdviceResult<IProperty> IntroduceAutomaticProperty(INamedType targetType, string propertyName, IType propertyType, IntroductionScope scope, OverrideStrategy whenExists, Action<IPropertyBuilder> buildProperty = null, object tags = null)
Parameters
Type Name Description
INamedType targetType

The type into which the property must be introduced.

System.String propertyName

Name of the introduced field.

IType propertyType

Type of the introduced field.

IntroductionScope scope

Determines the scope (e.g. Instance or Static) of the introduced field. The default scope is Instance.

OverrideStrategy whenExists

Determines the implementation strategy when a property of the same name is already declared in the target type. The default strategy is to fail with a compile-time error.

System.Action<IPropertyBuilder> buildProperty
System.Object tags
Returns
Type Description
IIntroductionAdviceResult<IProperty>

An IPropertyBuilder that allows to dynamically change the name or type of the introduced property.

See Also