Example #1
0
        public static Task <T> FromCanceled <T>(this CancellationToken cancellationToken)
        {
            MiscellaneousUtils.Assert(cancellationToken.IsCancellationRequested);
#pragma warning disable CS8603 // Possible null reference return.
            return(new Task <T>(() => default, cancellationToken));
Example #2
0
 public static Task FromCanceled(this CancellationToken cancellationToken)
 {
     MiscellaneousUtils.Assert(cancellationToken.IsCancellationRequested);
     return(new Task(() => {}, cancellationToken));
 }