Open sandboxFocus

Interface IIndexerInvoker

Allows generating run-time code that accesses indexer items when you have the compile-time IIndexer representation.

Namespace: Metalama.Framework.Code.Invokers
Assembly: Metalama.Framework.dll
Syntax
[CompileTime]
public interface IIndexerInvoker
Remarks

Invokers are APIs that allow you to generate run-time code from compile-time declarations. When you have an IIndexer object (a compile-time representation of an indexer), you can use its indexer syntax to create IExpression objects that represent indexed access. The returned expression can be used to get or set indexer values in template code via the Value property.

Use WithObject(dynamic) to specify the target instance and WithOptions(InvokerOptions) to control nullability behavior (such as using the ?. operator) and which implementation layer (base, current, or final) to access.

By default, the indexer is accessed on the current object (this) for instance indexers. The base implementation is accessed, i.e. the implementation before the current aspect layer.

Properties

Name Description
this[IExpression[]]

Gets an IExpression representing an item, with arguments represented as a list of IExpression.

this[dynamic?[]]

Gets an IExpression representing an item, with arguments represented as run-time C# expressions.

Methods

Name Description
GetValue(params dynamic?[])
SetValue(dynamic?, params dynamic?[])
With(InvokerOptions)
With(dynamic?, InvokerOptions)
WithObject(IExpression)

Gets an IIndexerInvoker for the same method but with a different object, provided as a compile-time IExpression.

WithObject(dynamic)

Gets an IIndexerInvoker for the same method but with a different object, provided as a C# expression.

WithOptions(InvokerOptions)

Gets an IIndexerInvoker for the same index and target but with different options.

Extension Methods

See Also