Open vweijsters opened 9 years ago
While this is old, is it still up for debate?
@ChrSteinert Sure, feedback is always welcome. :smile:
Ok, so here I go :wink:
Having a Task
as the type of a property must not always be a "bad" thing. I remember some custom task runner I once wrote (with retry policies and stuff). At least the internal bits had Tasks as fields and properties. This scenario seems small, so I'd rather vote for a warning. Also, even in this scenario, having a property, which, by the semantics of a property, is supposed to be publicly exposed, with type task seems worth a warning for above mentioned reasons. So pleas, let's make it a thing ;)
Inspired by #21:
Properties should not be of type
Task
orTask<T>
. Most people perceive properties as near instantaneous (synchronous) operations.Task
andTask<T>
are associated with asynchronous operations and should therefore not be used as property types, as this does not match with the expectations of the majority of developers.