小编Sas*_*shi的帖子

运行异步代码 C# 时未找到 AsyncMethodBuilder.cs

每当我尝试调试代码但无法继续时,我都会收到错误。

未找到 AsyncMethodBuilder.cs

背景信息:

我必须用最少的时间压缩大量的文档。我有一个压缩库,我能够同步进行压缩。但为了加快速度,我想并行压缩文档(一次压缩的文档没有可编程的),这样 1.我会正确利用 CPU 并在最佳时间内完成工作。

为了实现上述目标,我按照链接创建了多个任务并等待它们完成

下面是我尝试过的代码。

public static class CompressAllTechniques
    {
        public static void Main()
        {
            GoCallAPIAsync();
        }

        private static async void GoCallAPIAsync()
        {
            try
            {
                List<Task> TaskList = new List<Task>();
// For Sample testing I have taken 4 files and will iterate through them to check the timings
                const string originalFile1 = @"Sample Data\source";
                const string originalFile2 = @"Sample Data\source1";
                const string originalFile3 = @"Sample Data\Original";
                const string originalFile4 = @"Sample Data\Original1";
                List<string> …
Run Code Online (Sandbox Code Playgroud)

.net c# asynchronous async-await c#-5.0

6
推荐指数
1
解决办法
5371
查看次数

标签 统计

.net ×1

async-await ×1

asynchronous ×1

c# ×1

c#-5.0 ×1