-3
請注意,它必須只有.NET 4.0代碼!允許使用async/await關鍵字和Task類。但是在.NET 4.0中沒有像WhenAny()這樣的方法。c#.net 4.0遏制模式異步下載
我有個任務將程序功能,將:
///Return the content of required uris.
/// Method has to use the asynchronous way.
/// maxConcurrentStreams parameter should control the maximum of
/// concurrent streams that are running at the same time (throttling).
/// <param name="uris">Sequence of required uri</param>
/// <param name="maxConcurrentStreams">Max count of concurrent request streams</param>
/// <returns>The sequence of downloaded url content</returns>
public static IEnumerable<string> GetUrlContentAsync(this IEnumerable<Uri> uris, int maxConcurrentStreams)
{
.... ???
}
所以。問題是uri下載字符串數據(只是html),同時最多併發strem(節流)。
「.NET 4.0 only」是什麼意思?不再支持.NET 4.0,而C#6.0與4.5一起推出。最早支持的.NET版本是4.5.2。 TLS 1.2僅支持4.5.2及更高版本,因此TCP相關的任何內容至少應以4.5.2爲目標。 –
你想要什麼類型的節流?在問題文本中指定,而不是註釋。 –
你試過了什麼? – tym32167