OperationBase.Cancel Method
[WCF RIA Services Version 1 Service Pack 2 is compatible with either .NET framework 4 or .NET Framework 4.5, and with either Silverlight 4 or Silverlight 5.]
Cancels the operation.
Namespace: System.ServiceModel.DomainServices.Client
Assembly: System.ServiceModel.DomainServices.Client (in System.ServiceModel.DomainServices.Client.dll)
Syntax
'Declaration
Public Sub Cancel
'Usage
Dim instance As OperationBase
instance.Cancel()
public void Cancel()
public:
void Cancel()
member Cancel : unit -> unit
public function Cancel()
Exceptions
Exception | Condition |
---|---|
NotSupportedException | SupportsCancellation is false. |
InvalidOperationException | The operation has already completed. |
Remarks
The default implementation of the SupportsCancellation property always returns false. You must override the SupportsCancellation property and the CancelCore method in order to support cancellation in your operation.
The Cancel method invokes both the CancelCore method and the completeAction delegate specified in the constructor. Upon completion of the operation, check the IsCanceled property to determine whether the operation was successfully canceled.
Note
Successful cancellation does not guarantee state changes were prevented from happening on the server.
The INotifyPropertyChanged.PropertyChanged event is raised for the following properties: IsCanceled, CanCancel, and IsComplete.