Answers for "c# return task list"

C#
0

c# return task list

private async Task<List<Item>> GetListAsync(){
  	//Create a list object and assign it to a new task
  	//which returns your list object
    List<Item> list = await Task.Run(() => manager.GetList());
  
  	return list;
  
  	//Or you may just need to await something and just return a list
	await SomeMethod();
	List<Item> list1 = new List<Item>();
 
    return list;
}
Posted by: Guest on September-23-2020

C# Answers by Framework

Browse Popular Code Answers by Language