// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
namespace System.Reactive
{
///
/// Provides a mechanism for receiving push-based notifications and returning a response.
///
///
/// The type of the elements received by the observer.
/// This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
///
///
/// The type of the result returned from the observer's notification handlers.
/// This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics.
///
#if !NO_VARIANCE
public interface IObserver
#else
public interface IObserver
#endif
{
///
/// Notifies the observer of a new element in the sequence.
///
/// The new element in the sequence.
/// Result returned upon observation of a new element.
TResult OnNext(TValue value);
///
/// Notifies the observer that an exception has occurred.
///
/// The exception that occurred.
/// Result returned upon observation of an error.
TResult OnError(Exception exception);
///
/// Notifies the observer of the end of the sequence.
///
/// Result returned upon observation of the sequence completion.
TResult OnCompleted();
}
}