Call function after a period of time in C# -
i have c# code call function like:
private void cmdcommand_click(object sender, eventargs e) { m_socclient.close(); }
but want m_socclient.close();
function called after maybe 30 second. possible?
yes, using async / await
feature:
private async void cmdcommand_click(object sender, eventargs e) { await task.delay(30000); m_socclient.close(); }
you can using thread.sleep
block ui
thread , window won't responsive until task finished.
Comments
Post a Comment