TheSwamp

Code Red => .NET => Topic started by: cadplayer on November 13, 2017, 07:45:39 AM

Title: Tasks with ReadDwg() to accelerate progress
Post by: cadplayer on November 13, 2017, 07:45:39 AM
Hello !

Someone which have experience with .net Task class and implement multiple Tasks in progress with reading Files ?
Code: [Select]
tasks = new Task<List<File>>[count];
                    string message = string.Empty;
                    int procent = 100 / count;
                    for (int i = 0; i < count; i++)
                    {
                        tasks[i] = new Task<List<File>>(() =>
                        {
                            return ReadBlocks(BlockData.SelectedFiles[i]);
                        });
                        tasks[i].Start();
                        read = tasks[i].Result;
                        toolStripProgressBar1.Value = procent * i;
                    }


I test this Code to read Blockattributes from "unopened" files.
But doing this with Task accelerate not progressing. Who have idea to do it faster by the way ?