-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
@GSPP commented on Sat Aug 13 2016
Task already has a few shortcut properties: IsFaulted, IsCancelled, IsCompleted. These are useful because they provide a way to write certain conditions very succinctly.
The only such property missing is IsCompletedSuccessfully. It should be added.
The workarounds are a little awkward: t.Status == TaskStatus.RanToCompletion and !t.IsFaulted && !t.IsCanceled. They are longer, don't express meaning well and sometimes are written incorrectly (e.g. forgetting about cancellation).
Is there a reason IsCompletedSuccessfully can/should not exist?
@omariom commented on Sat Aug 13 2016
IsSucceeded?
@benaadams commented on Sat Aug 13 2016
IsCompletedSuccessfully would match ValueTask which has it
@GSPP commented on Sat Aug 13 2016
Yes, I think Task and ValueTask should have as much common surface area as possible to make it easy to switch between the two.
It might even make sense to add a Status property to ValueTask and synthesize a suitable status in case the object is not based on a task.
@jamesqo commented on Sun Aug 14 2016
Since ValueTask has it, 👍 from me.
Also I thought API requests go in corefx? (at least that's what I got told here)
@GSPP commented on Mon Aug 15 2016
I believe mscorlib types are supposed to be discussed here. I always check the file system on Github first to see where a given type lives. @jamesqo
@omariom commented on Mon Aug 15 2016
IsCompletedSuccessfullywould matchValueTaskwhich has it
Is it late to change ValueTask? )
@ghost commented on Mon Aug 15 2016
IsSucceeded?
HasSucceeded?
just bikesheding .. :)