Remove() public static method

public static Remove ( object rcw, Guid iid, int dispid, Delegate d ) : Delegate
rcw object
iid Guid
dispid int
d Delegate
return Delegate
 public override void RemoveEventHandler(object target, Delegate handler)
 {
     if (Marshal.IsComObject(target))
     {
         Guid guid;
         int  num;
         GetDataForComInvocation(this._innerEventInfo, out guid, out num);
         new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
         ComEventsHelper.Remove(target, guid, num, handler);
     }
     else
     {
         this._innerEventInfo.RemoveEventHandler(target, handler);
     }
 }
示例#2
0
        public override void RemoveEventHandler(object target, Delegate handler)
        {
            if (Marshal.IsComObject(target))
            {
                // retrieve sourceIid and dispid
                GetDataForComInvocation(_innerEventInfo, out Guid sourceIid, out int dispid);

                ComEventsHelper.Remove(target, sourceIid, dispid, handler);
            }
            else
            {
                // we are dealing with a managed object - just add the delegate through reflection
                _innerEventInfo.RemoveEventHandler(target, handler);
            }
        }