<PackageReference Include="System.ClientModel" Version="1.3.0" />

PipelinePolicy

public abstract class PipelinePolicy
A policy that can be added to a ClientPipeline to process a PipelineMessage during a call to Send. Types deriving from PipelinePolicy can read or modify the Request, implement functionality based on Response, and must pass control to the next PipelinePolicy in the pipeline by calling ProcessNext.
using System.Collections.Generic; using System.Runtime.CompilerServices; using System.Threading.Tasks; namespace System.ClientModel.Primitives { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public abstract class PipelinePolicy { public abstract void Process(PipelineMessage message, IReadOnlyList<PipelinePolicy> pipeline, int currentIndex); public abstract ValueTask ProcessAsync(PipelineMessage message, IReadOnlyList<PipelinePolicy> pipeline, int currentIndex); protected static void ProcessNext(PipelineMessage message, IReadOnlyList<PipelinePolicy> pipeline, int currentIndex) { currentIndex++; pipeline[currentIndex].Process(message, pipeline, currentIndex); } [AsyncStateMachine(typeof(<ProcessNextAsync>d__3))] protected static ValueTask ProcessNextAsync(PipelineMessage message, IReadOnlyList<PipelinePolicy> pipeline, int currentIndex) { <ProcessNextAsync>d__3 stateMachine = default(<ProcessNextAsync>d__3); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder.Create(); stateMachine.message = message; stateMachine.pipeline = pipeline; stateMachine.currentIndex = currentIndex; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } } }