C# 多线程与异步编程

本文探讨了C#中多线程和异步编程的区别,指出异步编程关注等待而非并行,它不会创建新线程,而是利用现有线程。通过async和await关键字实现非阻塞等待,避免UI阻塞。多线程则用于实现任务的平行处理。建议在适当场景使用非阻塞式等待。
摘要由CSDN通过智能技术生成

写在前面

自从介入UI界面编程以后,就免不了使用多线程处理问题,而一直一直以来却并没有仔细了解多线程和异步究竟有什么区别,这篇文章就以现在的认知来聊一聊。

异步编程是怎么运行的?

阅读

来看一篇文章

Asynchronous programming is a bit more general in that it has to do with latency (something on which your application has to wait, for one reason or another), whereas multithreaded programming is a way to achieve parallelization (one or more things that your application has to do at the same time). That said, the two topics are closely related; an application that performs work on multiple threads in parallel will often need to wait until such work is completed in order to take some action (e.g. update the user interface). So, this idea of waiting is the more general characteristic that is referenced by the term asynchronous, regardless of thread coun

  • 1
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值