예제 #1
0
        private static SwitchContext <TCapture> CreateContext <TCapture>(TCapture capture, CancellationTokenSource cancellationTokenSource)
        {
            var cancellationToken = cancellationTokenSource != null ? cancellationTokenSource.Token : CancellationToken.None;
            var context           = new SwitchContext <TCapture>(capture, cancellationToken);

            return(context);
        }
예제 #2
0
 public static SwitchCaseCondition <MochiUnit> UnsafeCase <TCapture>(this SwitchContext <TCapture> _, Task task)
 => UnsafeCase(_, (MochiTask <MochiUnit>)task.ToMochiTask());
예제 #3
0
 public static SwitchCaseCondition <MochiUnit> UnsafeDefault <TCapture>(this SwitchContext <TCapture> _)
 => new SwitchCaseCondition <MochiUnit>(true, new Awaiter <MochiUnit>(default(MochiUnit)));
예제 #4
0
 public static SwitchCaseCondition <T> UnsafeCase <TCapture, T>(this SwitchContext <TCapture> _, MochiTask <T> task)
 => new SwitchCaseCondition <T>(true, task.GetAwaiter());
예제 #5
0
 public static SwitchCaseCondition <T> UnsafeCase <TCapture, T>(this SwitchContext <TCapture> _, Task <T> task)
 => UnsafeCase(_, task.ToMochiTask());