Click to See Complete Forum and Search --> : release resource for WebClient class


George2
June 2nd, 2008, 07:41 AM
Hello everyone,


I find there is no resource release method for WebClient class, e.g. a method called "Close".

My usage scenario is,

1. Creating a new instance of WebClient;
2. Post byte[] data using UploadData method, and retrieve return data also using byte[].

In my scenario, are there any need to call some methods to release the resource (I suepect there is request stream handle and response stream handle to release)?


thanks in advance,
George

cilu
June 2nd, 2008, 08:41 AM
WebClient implements IDisposable (actually, its base class does). So, when you no longer need it, call Dispose().

George2
June 3rd, 2008, 06:05 AM
Great cilu!


Question answered.

WebClient implements IDisposable (actually, its base class does). So, when you no longer need it, call Dispose().


regards,
George