-2

Is there a way to convert a list from List<> to Task<List<>> ? I know Task<List<>> to List<> but I don't know to other direction.

Thanks,

TheBoubou
  • 19,487
  • 54
  • 148
  • 236
  • 2
    Why? What are you trying to do? It matters. Do you want to create a "finished" task that contains a `List<>` payload? `Task.FromResult(someList)`. – Panagiotis Kanavos Dec 04 '20 at 21:04

2 Answers2

0

Have you tried Task.FromResult(list)? Where list is the variable storing reference to your Collection.

SzybkiDanny
  • 204
  • 2
  • 11
-1

I think you want Task.FromResult(* your List<> here *)

Jesse C. Slicer
  • 19,901
  • 3
  • 68
  • 87