使用VB.NET命中URL(Get and Forget)
问题描述:
我想使用vb.net创建get and forget Url。基本上我会推一个网址(只需从url获得响应,不会在浏览器中显示/在后台运行)并忘记。点击按钮时,我想同时按下10个网址。这是我的代码,但它仍然处理URL的URL一个接一个。使用VB.NET命中URL(Get and Forget)
我已经尝试使用任务,但包含“Imports System.Threading.Tasks”时出现错误,因为我的.net框架版本仍然是3.5。 这是不可能升级我的.Net版本,所以有人有建议? :)
答
前
请让我知道该怎么办,谢谢你可以使用普通线程这样的事情。我的VB.Net非常生锈。以下是我将在C#中完成的操作。它应该直接翻译为VB.Net
List<Thread> threads = new List<Thread>();
foreach (string url in MyUrls)
{
Thread t = new Thread(() => MyUrlPushMethod(url));
t.Start();
threads.Add(t);
}
foreach (var thread in threads)
{
thread.Join();
}
嗨,是你的代码?并且..是的,您可以升级您的.net版本...升级后,您可以选择应用程序属性中使用的.net版本 – Chris