Sharon <Sh****@discussions.microsoft.com> wrote:
I think the URL you posted explained it ok.
But it?s causing me some trouble:
When I wish to release my object that uses Remoting, I set the delegate to
null like that:
// Call this to set my handler upon the delegate
m_MyRemotingMarshal.SomeDelegate += new SomeDelegateType(My Method Handler);
// This is causing for a Compiler Error CS0070 that asks me to use -=
m_MyRemotingMarshal.SomeDelegate = null;
How should I use the -= instead the =null in the above example to avoid the
error?
You can't set it to null - you can only remove an eventhandler, so just
use:
m_MyRemotingMarshal.SomeDelegate -= new SomeDelegate(MyMethodHandler);
to remove the one you've added before.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too