Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 342 Bytes

PH_S012.md

File metadata and controls

9 lines (5 loc) · 342 Bytes

PH_S012 - Task only returning value

Problem

Creating and starting a new task using Task.Factory.StartNew(...) or Task.Run(...) that only returns an already computed value is pointless and unnecessary overhead.

Solution

Replace the task creation with Task.FromResult(...) to create a completed task with the specified value.