Hey guys I am having trouble understanting await. What I really need to do is have a for loop which searches between 10,000 values in an array show me which values contain certain letters.
Right now without Tasks this process works but lags the app around 4 seconds per request which is why I believe I need to do this using Tasks and Await.
The task doesnt need to return anything. All I really need it to tell it to wait until the Task has ended without causing me to lag. It lags when using the searchbar and typing in letters, every letter causes the app to lag 5 seconds. What I want is for the input for the searchbar to not lag at all and just wait for the Task to finish.
This is the function I am trying to work with.
async Task searchLoop()
{
string word = GetDataValue(items[x], "Name:");
searchWord = searchWord.ToLower();
if (word.Contains(searchWord))
{
myButton[counter].Text = GetDataValue(items[x], "Name:");
myButton[counter].StyleId = x.ToString();
counter++;
}
}
I tried a similar thing using Webclient and DownloadStringTaskAsync and it works exactly like I want it to, but I want to do it locally and not need a Webclient to feed me the information I need.