IObserver<T>.OnCompleted IObserver<T>.OnCompleted IObserver<T>.OnCompleted IObserver<T>.OnCompleted Method

定義

プロバイダーでプッシュ ベースの通知の送信が完了したことをオブザーバーに通知します。Notifies the observer that the provider has finished sending push-based notifications.

public:
 void OnCompleted();
public void OnCompleted ();
abstract member OnCompleted : unit -> unit
Public Sub OnCompleted ()

次の例の実装を提供する、OnCompleted追跡アプリケーションの緯度/経度のメソッド。The following example provides an implementation of the OnCompleted method in a latitude/longitude tracking application. メソッドは、さらにデータがありませんが利用し、プロバイダーの呼び出しに単に報告IDisposable.Dispose実装します。The method simply reports that no further data is available and calls the provider's IDisposable.Dispose implementation. 例を参照してください、IObserver<T>完全な例についてはトピック。See the Example section of the IObserver<T> topic for the complete example.

public virtual void OnCompleted()
{
   Console.WriteLine("The Location Tracker has completed transmitting data to {0}.", this.Name);
   this.Unsubscribe();
}
Public Overridable Sub OnCompleted() Implements System.IObserver(Of Location).OnCompleted
   Console.WriteLine("The Location Tracker has completed transmitting data to {0}.", Me.Name)
   Me.Unsubscribe()
End Sub

注釈

オブザーバーのOnCompleted実装が呼び出されると、OnCompletedメソッドを呼び出すことができます必要に応じて、Disposeのメソッド、IDisposableが呼び出されたときに、オブザーバーに返されたオブジェクト、IObservable<T>.Subscribeメソッド。When the observer's OnCompleted implementation is called, the OnCompleted method can optionally call the Dispose method of the IDisposable object that was returned to the observer when it called the IObservable<T>.Subscribe method.

適用対象