I'm using PageAsyncTask to call a WCF service in c# (.Net 3.5).
My question is, do I need to tidy up the proxy on time-out, or is this unnecessary because it is created in a Using block?
Here's some pseudo code which includes some "tidy-up" code on time-out:
private WCFProxy proxy;
IAsyncResult BeginEvent(...)
{
Using (proxy = new WCFProxy)
{
//do some stuff
proxy.DoLongRunningWork();
if (proxy != null) proxy.close();
}
}
public void TimeoutEvent(IAsyncResult result)
{
//timeout :-(
if (proxy != null)
{
proxy.Abort();
proxy = null;
}
}