Open sandboxFocus

Interface IFieldOrPropertyInvoker

Allows generating run-time code that accesses a field or property when you have its compile-time IFieldOrProperty representation.

Namespace: Metalama.Framework.Code.Invokers
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IFieldOrPropertyInvoker : IExpression, IHasType
Remarks

Invokers are APIs that allow you to generate run-time code from compile-time declarations. When you have an IFieldOrProperty object (a compile-time representation of a field or property), you can use it as an IExpression to access its value in generated code. Since this interface implements IExpression, you can use the Value property to get or set the field or property value directly in template code.

For fields, you can also use ref when accessing the Value property, allowing you to pass fields by reference. Use WithObject(dynamic?) to specify the target instance and WithOptions(InvokerOptions) to control nullability behavior and which implementation layer (base, current, or final) to access.

By default, the field or property is accessed on the current object (this) for instance members. The base implementation is accessed, i.e. the implementation before the current aspect layer.

Methods

Name Description
With(InvokerOptions)
With(dynamic?, InvokerOptions)
WithObject(IExpression?)

Gets an IFieldOrPropertyInvoker for the same field or property but with a different object.

WithObject(dynamic?)
WithOptions(InvokerOptions)

Gets an IFieldOrPropertyInvoker for the same field or property and target but with different options.

Extension Methods

See Also