What is the equivalent of FromCanceled(CancellationToken) in .NET 4.5?
Advertisements I want to achieve something similar to this in .NET 4.5 public virtual Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (!cancellationToken.IsCancellationRequested) { return BeginEndWriteAsync(buffer, offset, count); } return Task.FromCancellation(cancellationToken); } Task.FromCanceled(CancellationToken) method is available in .NET 8. I would like to know its equivalent in .NET 4.5. >Solution : In… Read More What is the equivalent of FromCanceled(CancellationToken) in .NET 4.5?