![](/img/trans.png)
[英]How do you deal with CA2000 (Dispose of IDisposable Objects) when the objects are placed in a Dependency Injection container?
根據 Microsoft 的說法,HttpClient 的最佳實踐是維護 HttpClient 的 singleton 版本(釋義,但這是結果。不要立即處理它)。 我自己的測試表明,與為每條消息重新創建 HttpClient 相比,執行大規模 Http 操作時,單個實例具有明顯的優勢。 因此,自然 ...