namespace Try_More_On_IEnumerable
static void Main(string[] args)
Console.WriteLine($"运行成功,{DateTime.Now:O}");
namespace Try_More_On_IEnumerable
using System.Collections.Generic;
using System.Threading.Tasks;
public static async Task Run()
var httpClient = new HttpClient();
await Task.WhenAll(SendRequests());
Console.WriteLine("当前网络连接正常");
Console.WriteLine("当前网络不正常,请检查网络连接");
IEnumerable<Task> SendRequests()
yield return Task.Run(() => httpClient.GetAsync("http://www.baidu.com"));
yield return Task.Run(() => httpClient.GetAsync("http://www.bing.com"));
yield return Task.Run(() => httpClient.GetAsync("http://www.taobao.com"));