Search code examples
.nethttpwebrequest

Is there a correct way to dispose of a httpwebrequest?


I am using a HttpWebRequest, and am disposing of the response stream. Is there a correct method of disposing of the HttpWebRequest, as it does not contain a close or dispose method?


Solution

  • If the class had special disposal requirements, it would have implemented IDisposable. Since it doesn't implement IDisposable, you may assume there's nothing special you need to do.