PostSharp SDK 2023.0 / / Class Reference / Post­Sharp.​Sdk.​Aspect­Infrastructure Namespace / Method­Mapping­Writer Class / Method­Mapping­Writer Methods / Method­Mapping­Writer.​Emit­Store­Context­Item­Into­Local­Conditional Method / Method­Mapping­Writer.​Emit­Store­Context­Item­Into­Local­Conditional Method (Method­Mapping­Context­Item, ILocal­Storage, IType­Signature, Instruction­Writer, Action(Instruction­Writer, ILocal­Storage), Action(Instruction­Writer, ILocal­Storage))

MethodMappingWriter.EmitStoreContextItemIntoLocalConditional Method (MethodMappingContextItem, ILocalStorage, ITypeSignature, InstructionWriter, Action<InstructionWriter, ILocalStorage>, Action<InstructionWriter, ILocalStorage>)

Emits instructions that store the value of a context item to a local variable. If the item is not available in the current context, it is loaded using instructions emitted by a delegate.

Namespace:  PostSharp.Sdk.AspectInfrastructure
Assembly:  PostSharp.Compiler.Engine (in PostSharp.Compiler.Engine.dll) Version: 2023.0.3.0 (2023.0.3.0)
public void EmitStoreContextItemIntoLocalConditional(
	MethodMappingContextItem methodMappingContextItem,
	ref ILocalStorage contextItemLocal,
	ITypeSignature contextItemType,
	InstructionWriter instructionWriter,
	Action<InstructionWriter, ILocalStorage> loadContextItemAction,
	Action<InstructionWriter, ILocalStorage> emitIfLoadedFromContextAction


Type: PostSharp.Sdk.AspectInfrastructure.MethodMappingContextItem
The context item.
Type: PostSharp.Sdk.AspectInfrastructure.ILocalStorage
The local variable where the value of the context item should be stored. If the input value of this parameter is null, a local variable of type contextItemType is created.
Type: PostSharp.Sdk.CodeModel.ITypeSignature
The type of the context item, used to create the local variable if contextItemLocal is null.
Type: PostSharp.Sdk.CodeModel.InstructionWriter
An InstructionWriter.
Type: System.Action<InstructionWriter, ILocalStorage>
A delegate that emits instructions that load the context item value on the stack. This delegate is invoked in case the item is not available in the current context.
Type: System.Action<InstructionWriter, ILocalStorage>
A delegate that emits instructions executed in case the item has been loaded from context, or null if nothing should be executed if the item is loaded from context.
See Also