<PackageReference Include="System.Reactive" Version="6.0.1-preview.1" />
    
	
	
		
		
		
	 
	
	
        
                
                ElementAtOrDefault<TSource>
                
                
                
                
using System.
Runtime.
CompilerServices;
namespace System.
Reactive.
Linq.
ObservableImpl
{
    [
System.
Runtime.
CompilerServices.
NullableContext(
1)]
    [
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
        
0,
        
2,
        
1,
        
1
    })]
    
internal sealed class ElementAtOrDefault<[
System.
Runtime.
CompilerServices.
Nullable(
2)] 
TSource> : 
Producer<
TSource, 
ElementAtOrDefault<
TSource>.
_>
    {
        [
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
            
0,
            
1,
            
2
        })]
        
internal sealed class _ : 
Sink<
TSource, 
TSource>
        {
            
private int _i;
            
public _(
int index, [
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
                
1,
                
2
            })] 
IObserver<
TSource> 
observer)
                : 
base(
observer)
            {
                
_i = 
index;
            }
            
public override void OnNext(
TSource value)
            {
                
if (
_i == 
0) {
                    
ForwardOnNext(
value);
                    
ForwardOnCompleted();
                }
                
_i--;
            }
            
public override void OnCompleted()
            {
                
ForwardOnNext(
default(
TSource));
                
ForwardOnCompleted();
            }
        }
        
private readonly IObservable<
TSource> 
_source;
        
private readonly int _index;
        
public ElementAtOrDefault(
IObservable<
TSource> 
source, 
int index)
        {
            
_source = 
source;
            
_index = 
index;
        }
        [
return: 
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
            
1,
            
0
        })]
        
protected override _ CreateSink([
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
            
1,
            
2
        })] 
IObserver<
TSource> 
observer)
        {
            
return new _(
_index, 
observer);
        }
        
protected override void Run([
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
            
1,
            
0
        })] 
_ sink)
        {
            
sink.
Run(
_source);
        }
    }
}