我已经对这个主题进行了大量的搜索,我在这个网站上阅读了关于这个主题的大部分帖子,但是我仍然感到困惑,我需要一个直接的答案.这是我的情况:
我有一个已建立的Winform应用程序,我无法将其全部"异步".我现在被迫使用一个全部写为异步函数的外部库.
在我的申请中,我有
/// <summary>
/// This function I can't change it to an 'async'
/// </summary>
public void MySyncFunction()
{
//This function is my point in my application where I have to call the
//other 'async' functions but I can't change the function itself to 'async'
try
{
//I need to call the MyAsyncDriverFunction() as if it is a synchronous function
//I need the driver function to finish execution and return before processing the code that follows it
//I …Run Code Online (Sandbox Code Playgroud)