First, the WCF proxy is IDisposable , so you can use using :
using(var proxy = new MyProxy()) {
Unfortunately , WCF also has a buggy Dispose() function that regularly throws exceptions. However, here is a really cool trick to make it work correctly. I also wrote about this, but I think the first link is much better.
So: use IDisposable and using , but use it with caution (in this case).
Setting the field usually does not matter. There are several edge cases (such as variables captured by several delegates, static fields, objects with a long lifetime, etc.), but in general leave it alone. In particular, do not do this, as this could theoretically extend life:
if(field != null) field = null;
source share