I am creating a program that will multiple background tasks simultaneously. I would like to create a numbe开发者_开发问答r of threads to do these based on the number of cores that a client is running. So that if they are using a multi-core processor, the program will run faster. Is there any way to have C# check how many cores a processor has? Finding model of the processor would also work.
You could use Environment.ProcessorCount, although I would avoid this sort of optimization because the Task Parallel Library takes care of it for you.
加载中,请稍侯......
精彩评论