2 ms·
There's one less line of code if you use Encoding.UTF8 instead of instantiating your own object (although in principle the encoding is given to you in HttpWebRe
by timrobinson 16y ago
There's one less line of code if you use Encoding.UTF8 instead of instantiating your own object (although in principle the encoding is given to you in HttpWebResponse.ContentEncoding).
The Microsoft samples don't seem to do this, but consider putting your WebResponse and StreamReader objects in 'using' blocks: these classes implement IDisposable to ensure orderly cleanup.