返回C#中的异步方法类型

时间:2015-12-18 21:57:58

标签: c#

如何从异步方法返回void之外的其他内容。目前我正试图通过

来做到这一点
private static async Task<byte[]>  menu(int len, string data)

但这显示错误:

The type or namespace name 'Task<byte []>' could not be found (are you missing a using directive or an assembly reference?

我正在使用Visual Studio 2015 CE。

1 个答案:

答案 0 :(得分:1)

通过在源代码文件上编写System.Threading.Task来包含using System.Threading.Task命名空间。

相关问题