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

C# C中异步方法的返回类型#,c#,C#,如何从异步方法返回void以外的内容。目前,我正试图通过 private static async Task<byte[]> menu(int len, string data) private静态异步任务菜单(int len,字符串数据) 但这是一个错误: The type or namespace name 'Task<byte []>' could not be found (are you missing a using directive or an as

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

private static async Task<byte[]>  menu(int len, string data)
private静态异步任务菜单(int len,字符串数据)
但这是一个错误:

The type or namespace name 'Task<byte []>' could not be found (are you missing a using directive or an assembly reference?
找不到类型或命名空间名称“Task”(您是否缺少using指令或程序集引用?

我正在使用Visual Studio 2015 CE。

通过在源代码文件的顶部使用System.Threading.Task写入
来包含
System.Threading.Task
命名空间。

使用System.Threading.Tasks
?是否缺少using指令或程序集引用?首先读取错误消息,然后按照它提供给你的dvice,如果失败了(或者你不理解),研究一下错误信息的含义和解决方法;关于这个问题有很多现成的信息。