Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

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;
}
 
PREVIOUS NEXT
Tagged: #return #task #list
ADD COMMENT
Topic
Name
7+2 =