7 [global::__DynamicallyInvokable]
13 private object userSuppliedState;
15 private bool alreadyCompleted;
19 [global::__DynamicallyInvokable]
22 [global::__DynamicallyInvokable]
25 return userSuppliedState;
31 [global::__DynamicallyInvokable]
34 [global::__DynamicallyInvokable]
43 this.userSuppliedState = userSuppliedState;
44 this.syncContext = syncContext;
45 alreadyCompleted =
false;
52 if (!alreadyCompleted && syncContext !=
null)
64 [global::__DynamicallyInvokable]
65 public void Post(SendOrPostCallback d,
object arg)
68 VerifyDelegateNotNull(d);
69 syncContext.
Post(d, arg);
79 [global::__DynamicallyInvokable]
83 OperationCompletedCore();
89 [global::__DynamicallyInvokable]
93 OperationCompletedCore();
96 private void OperationCompletedCore()
104 alreadyCompleted =
true;
109 private void VerifyNotCompleted()
111 if (alreadyCompleted)
113 throw new InvalidOperationException(SR.GetString(
"Async_OperationAlreadyCompleted"));
117 private void VerifyDelegateNotNull(SendOrPostCallback d)
121 throw new ArgumentNullException(SR.GetString(
"Async_NullDelegate"),
"d");
125 internal static AsyncOperation CreateOperation(
object userSuppliedState,
SynchronizationContext syncContext)
127 return new AsyncOperation(userSuppliedState, syncContext);
void OperationCompleted()
Ends the lifetime of an asynchronous operation.
virtual void Post(SendOrPostCallback d, object state)
When overridden in a derived class, dispatches an asynchronous message to a synchronization context.
Tracks the lifetime of an asynchronous operation.
static void SuppressFinalize(object obj)
Requests that the common language runtime not call the finalizer for the specified object.
SecurityAction
Specifies the security actions that can be performed using declarative security.
Provides the basic functionality for propagating a synchronization context in various synchronization...
virtual void OperationCompleted()
When overridden in a derived class, responds to the notification that an operation has completed.
Controls the system garbage collector, a service that automatically reclaims unused memory.
void Post(SendOrPostCallback d, object arg)
Invokes a delegate on the thread or context appropriate for the application model.
object UserSuppliedState
Gets or sets an object used to uniquely identify an asynchronous operation.
void PostOperationCompleted(SendOrPostCallback d, object arg)
Ends the lifetime of an asynchronous operation.
virtual void OperationStarted()
When overridden in a derived class, responds to the notification that an operation has started.