Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/313.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# IronPython 2.7可以调用异步.NET函数吗?_C#_Python 2.7_Asynchronous_Ironpython - Fatal编程技术网

C# IronPython 2.7可以调用异步.NET函数吗?

C# IronPython 2.7可以调用异步.NET函数吗?,c#,python-2.7,asynchronous,ironpython,C#,Python 2.7,Asynchronous,Ironpython,在我的应用程序中嵌入IronPython 2.7,并使用clr.AddReference访问托管的.NET dll 该DLL具有异步函数,例如: async public Task<string> Foo(string x) { string y=await bar(x); return y; } 并返回一个任务而不是字符串作为返回值,这是正确的。但是,如果我尝试这样做: g=f.Result 它会像预期的那样死锁。IronPython是否以任何方式支持与C的awa

在我的应用程序中嵌入IronPython 2.7,并使用clr.AddReference访问托管的.NET dll

该DLL具有异步函数,例如:

async public Task<string> Foo(string x) {
   string y=await bar(x); 
   return y;
}
并返回一个任务而不是字符串作为返回值,这是正确的。但是,如果我尝试这样做:

g=f.Result

它会像预期的那样死锁。IronPython是否以任何方式支持与C的await相同的语义

我对IronPython了解不多,但异步管理由.net安装处理,是该语言的一个特性

如果bar有一个异步任务的签名,那么您可以按照以下方式执行:var temp=await bar;临时等待;x=温度结果;
g=f.Result