Case<TValue, 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 Case<
TValue, [
System.
Runtime.
CompilerServices.
Nullable(
2)] 
TResult> : 
Producer<
TResult, 
Case<
TValue, 
TResult>.
_>, 
IEvaluatableObservable<
TResult>
    {
        [
System.
Runtime.
CompilerServices.
Nullable(
new byte[] {
            
0,
            
1
        })]
        
internal sealed class _ : 
IdentitySink<
TResult>
        {
            
public _(
IObserver<
TResult> 
observer)
                : 
base(
observer)
            {
            }
            
public void Run(
Case<
TValue, 
TResult> 
parent)
            {
                
IObservable<
TResult> 
source;
                
try {
                    
source = 
parent.
Eval();
                } 
catch (
Exception error) {
                    
ForwardOnError(
error);
                    
return;
                }
                
Run(
source);
            }
        }
        
private readonly Func<
TValue> 
_selector;
        
private readonly IDictionary<
TValue, 
IObservable<
TResult>> 
_sources;
        
private readonly IObservable<
TResult> 
_defaultSource;
        
public Case(
Func<
TValue> 
selector, 
IDictionary<
TValue, 
IObservable<
TResult>> 
sources, 
IObservable<
TResult> 
defaultSource)
        {
            
_selector = 
selector;
            
_sources = 
sources;
            
_defaultSource = 
defaultSource;
        }
        
public IObservable<
TResult> 
Eval()
        {
            
if (
_sources.
TryGetValue(
_selector(), 
out IObservable<
TResult> 
value))
                
return value;
            
return _defaultSource;
        }
        [
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(
this);
        }
    }
}