<PackageReference Include="Azure.Core" Version="1.44.1" />

Operation<T>

public abstract class Operation<T> : Operation
Represents a long-running operation that returns a value when it completes.
using Azure.Core; using System; using System.ComponentModel; using System.Runtime.CompilerServices; using System.Threading; using System.Threading.Tasks; namespace Azure { [System.Runtime.CompilerServices.NullableContext(1)] [System.Runtime.CompilerServices.Nullable(0)] public abstract class Operation<T> : Operation { public abstract T Value { get; } public abstract bool HasValue { get; } public virtual Response<T> WaitForCompletion(CancellationToken cancellationToken = default(CancellationToken)) { return new OperationPoller(null).WaitForCompletion<T>(this, (TimeSpan?)null, cancellationToken); } public virtual Response<T> WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken) { return new OperationPoller(null).WaitForCompletion<T>(this, (TimeSpan?)pollingInterval, cancellationToken); } [AsyncStateMachine(typeof(Operation<>.<WaitForCompletionAsync>d__6))] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] public virtual ValueTask<Response<T>> WaitForCompletionAsync(CancellationToken cancellationToken = default(CancellationToken)) { <WaitForCompletionAsync>d__6 stateMachine = default(<WaitForCompletionAsync>d__6); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Response<T>>.Create(); stateMachine.<>4__this = this; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } [AsyncStateMachine(typeof(Operation<>.<WaitForCompletionAsync>d__7))] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] public virtual ValueTask<Response<T>> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken) { <WaitForCompletionAsync>d__7 stateMachine = default(<WaitForCompletionAsync>d__7); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Response<T>>.Create(); stateMachine.<>4__this = this; stateMachine.pollingInterval = pollingInterval; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } public virtual Response<T> WaitForCompletion(DelayStrategy delayStrategy, CancellationToken cancellationToken) { return new OperationPoller(delayStrategy).WaitForCompletion<T>(this, (TimeSpan?)null, cancellationToken); } [AsyncStateMachine(typeof(Operation<>.<WaitForCompletionAsync>d__9))] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1, 1 })] public virtual ValueTask<Response<T>> WaitForCompletionAsync(DelayStrategy delayStrategy, CancellationToken cancellationToken) { <WaitForCompletionAsync>d__9 stateMachine = default(<WaitForCompletionAsync>d__9); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Response<T>>.Create(); stateMachine.<>4__this = this; stateMachine.delayStrategy = delayStrategy; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } [AsyncStateMachine(typeof(Operation<>.<WaitForCompletionResponseAsync>d__10))] [EditorBrowsable(EditorBrowsableState.Never)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] public override ValueTask<Response> WaitForCompletionResponseAsync(CancellationToken cancellationToken = default(CancellationToken)) { <WaitForCompletionResponseAsync>d__10 stateMachine = default(<WaitForCompletionResponseAsync>d__10); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Response>.Create(); stateMachine.<>4__this = this; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } [AsyncStateMachine(typeof(Operation<>.<WaitForCompletionResponseAsync>d__11))] [EditorBrowsable(EditorBrowsableState.Never)] [return: System.Runtime.CompilerServices.Nullable(new byte[] { 0, 1 })] public override ValueTask<Response> WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default(CancellationToken)) { <WaitForCompletionResponseAsync>d__11 stateMachine = default(<WaitForCompletionResponseAsync>d__11); stateMachine.<>t__builder = AsyncValueTaskMethodBuilder<Response>.Create(); stateMachine.<>4__this = this; stateMachine.pollingInterval = pollingInterval; stateMachine.cancellationToken = cancellationToken; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } } }