Home > Net >  Why would the platform does not support?
Why would the platform does not support?

Time:03-19

I use VS2019, under the small white want to learn,
Online code to copy in execution, direct error, said platform does not support?
Excuse me what's the problem?


CodePudding user response:

See the framework version, netcore above changed a lot, because netcore goal is cross-platform, so a lot of special features on Windows will no longer provide support

CodePudding user response:

Said the reason stated above, the following solutions,
Using the new Task syntax to complete this Task, this syntax is more straightforward than your current writing

Try
{
Var result=await task. Run (()=& gt; {you do})
}
Catche (ex)
{
}

This is what you want to function, "asynchronous wait for a task to complete, and get the results", he if there is abnormal, of course, you can also "collection" to the

CodePudding user response:

In addition, the way you had some really ugly, though you think he is an asynchronous, but he was in fact a synchronous blocking methods (while you use to block), and the true asynchronous method is not blocked, he USES the callback methods to notify the task to complete, at the same time using context context to keep the environment)

While the async/await task this kind of system, are actually using the IO signal , a lot of people like to put the content equivalent thread, in fact is not, thread is a thread, asynchronous is asynchronous, thread of execution is CPU task, and asynchronous task is IO task rather than the CPU tasks (you can start a thread for CPU execution, but await itself is waiting for an IO completion, rather than waiting for the thread to finish, so the async await itself and the threads are not equivalent, even if no thread he also can complete, such as you click buttonA start a task, to wait for ButtonB click, of course he can also be a asynchronous)
  •  Tags:  
  • C#
  • Related