使用C#中的线程下载多个文件 [英] Download multiple files using threads in C#
本文介绍了使用C#中的线程下载多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
昨天我接受了采访,他问我.
Q)编写代码,使用c#中的线程下载多个文件吗?
问)什么是Visual Studio中的Task?
谁能解释一下这些.
我尝试过的事情:
我知道线程,但是如何实现下载多个文件.
请帮帮我.
感谢
Hi guys,
Yesterday i had interview in that, he asked me.
Q)Write a code, to download multiple files using threads in c#?
Q)What is Task in visual studio?
can anyone please explain me, how these.
What I have tried:
I know threads, but how to implements to download multiple files.
Please help me.
Thanks
推荐答案
在Visual Studio中,您可以执行一项任务. .NET框架中的任务是完全不同的.我可以假设您是指任务并行库,但这只是一个假设.如果那是您的意思,那么我建议您使用Google-学习如何有效地使用Google事物是一项非常有价值的技能,它将对您的生活起到有益的作用.
至于下载文件,伪代码如下所示:
A task, in Visual Studio, is something you do. A Task in the .NET framework is something completely different. I could make an assumption that you mean the Task Parallel Library but that would just be an assumption. If that is the one you mean, then I would suggest that you Google it - learning how to Google things effectively is a hugely valuable skill that will serve you well in life.
As for downloading the files, the pseudo-code would look something like this:
For Each File in A List Of Files
Launch a thread - taking one of these files
Download this file
End For Each
这篇关于使用C#中的线程下载多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文