IObserver<T>.OnCompleted 메서드

정의

공급자가 푸시 기반 알림 전송을 완료했음을 관찰자에게 알립니다.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 메서드는 필요에 따라 IObservable<T>.Subscribe 메서드를 호출할 때 관찰자에 게 반환 된 IDisposable 개체의 Dispose 메서드를 호출할 수 있습니다.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.

적용 대상