<PackageReference Include="System.Reactive" Version="6.0.0-preview.1" />
For<TSource, TResult>
using System.
Collections.
Generic;
using System.
Runtime.
CompilerServices;
namespace System.
Reactive.
Linq.
ObservableImpl
{
[
System.
Runtime.
CompilerServices.
NullableContext(
1)]
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1,
1,
1,
1
})]
internal sealed class For<[
System.
Runtime.
CompilerServices.
Nullable(
2)]
TSource, [
System.
Runtime.
CompilerServices.
Nullable(
2)]
TResult> :
Producer<
TResult,
For<
TSource,
TResult>.
_>,
IConcatenatable<
TResult>
{
[
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
0,
1
})]
internal sealed class _ :
ConcatSink<
TResult>
{
public _(
IObserver<
TResult>
observer)
:
base(
observer)
{
}
}
private readonly IEnumerable<
TSource>
_source;
private readonly Func<
TSource,
IObservable<
TResult>>
_resultSelector;
public For(
IEnumerable<
TSource>
source,
Func<
TSource,
IObservable<
TResult>>
resultSelector)
{
_source =
source;
_resultSelector =
resultSelector;
}
[
return:
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0,
0
})]
protected override _ CreateSink(
IObserver<
TResult>
observer)
{
return new _(
observer);
}
protected override void Run([
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
1,
0,
0
})]
_ sink)
{
sink.
Run(
GetSources());
}
public IEnumerable<
IObservable<
TResult>>
GetSources()
{
foreach (
TSource item in this.
_source) {
yield return this.
_resultSelector(
item);
}
}
}
}