Hi everyone, I have something that i simply need to get some help with.
I am doing some exercises with async and await. I have this method that i want to make asynchronous. It simply supposed to take an array of strings, and then create a List of strings with the same content, but just with something appended to every string.
Now, I know that i need to put something as await, but I really dont know what! I simply want all the adding operations to happen on the different cores, so I know i need to do a await operation somewhere, but i really dont know what to do.
I really hope someone can help me out
I am doing some exercises with async and await. I have this method that i want to make asynchronous. It simply supposed to take an array of strings, and then create a List of strings with the same content, but just with something appended to every string.
C#:
private async static Task<List<string>> ParTest(string[] thisstringlist)
{
List<string> returnList = new List<string>();
for (int i = 0; i < thisstringlist.Length-1; ++i)
{
Task.Run(() => returnList.Add(thisstringlist + "pluuus this"));
}
return returnList;
}
I really hope someone can help me out
Last edited by a moderator: