<PackageReference Include="System.Reactive" Version="6.0.0-preview.1" />
All<TSource>
using System.
Runtime.
CompilerServices;
namespace System.
Reactive.
Linq.
ObservableImpl
{
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1,
1
})]
internal sealed class All<[
System.
Runtime.
CompilerServices.
Nullable(
2)]
TSource> :
Producer<
bool,
All<
TSource>.
_>
{
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1
})]
internal sealed class _ :
Sink<
TSource,
bool>
{
private readonly Func<
TSource,
bool>
_predicate;
public _(
Func<
TSource,
bool>
predicate,
IObserver<
bool>
observer)
:
base(
observer)
{
_predicate =
predicate;
}
public override void OnNext(
TSource value)
{
bool flag;
try {
flag =
_predicate(
value);
}
catch (
Exception error) {
ForwardOnError(
error);
return;
}
if (!
flag) {
ForwardOnNext(
false);
ForwardOnCompleted();
}
}
public override void OnCompleted()
{
ForwardOnNext(
true);
ForwardOnCompleted();
}
}
private readonly IObservable<
TSource>
_source;
private readonly Func<
TSource,
bool>
_predicate;
public All(
IObservable<
TSource>
source,
Func<
TSource,
bool>
predicate)
{
_source =
source;
_predicate =
predicate;
}
[
return:
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0
})]
protected override _ CreateSink(
IObserver<
bool>
observer)
{
return new _(
_predicate,
observer);
}
protected override void Run([
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0
})]
_ sink)
{
sink.
Run(
_source);
}
}
}