Click here to Skip to main content
15,894,180 members
Home / Discussions / C#
   

C#

 
AnswerRe: overriding an @ to force control chars to be interpreted Pin
Guffa5-Apr-06 9:21
Guffa5-Apr-06 9:21 
Questionxpath not working with an xmlns attribute Pin
Hari 20095-Apr-06 6:54
Hari 20095-Apr-06 6:54 
AnswerRe: xpath not working with an xmlns attribute Pin
Guffa5-Apr-06 8:02
Guffa5-Apr-06 8:02 
GeneralRe: xpath not working with an xmlns attribute Pin
Hari 20095-Apr-06 8:43
Hari 20095-Apr-06 8:43 
QuestionSoapHeaders??? Pin
bakerfishsticks5-Apr-06 6:05
bakerfishsticks5-Apr-06 6:05 
QuestionClearing event handlers Pin
vineas5-Apr-06 5:44
vineas5-Apr-06 5:44 
AnswerRe: Clearing event handlers Pin
Ed.Poore5-Apr-06 7:46
Ed.Poore5-Apr-06 7:46 
GeneralRe: Clearing event handlers Pin
vineas5-Apr-06 9:30
vineas5-Apr-06 9:30 
Ed.Poore wrote:
Try using:

if (MyEvent != null)
{
  Delegate[] delegateList = MyEvent.GetInvocationList();
  foreach (MyEventHandler meh in delegateList)
  {
    MyEvent -= meh;
  }
}


Basically your trying to remove a delegate that you've only just created, me thinks, what you need is a reference to the actual delegate as the above code demonstrates.

Ed


uh - did you read my initial post?!?!?!? That is exactly the first code snippet I listed (which does not work BTW - which then prompted me to continue to the other snippet, which also didn't work).

I still haven't found a solution to this. Some of the things I've found when searching around seem to indicate that others have tried and failed - so in the interest of brevity (and better code), for my own purposes, I re-did the section in question so am no longer facing this issue.*

I am still interested in a solution though - there have been other times I've wanted to do this, but haven't had the time to go much further - and from my searches I know others have wanted a solution as well.

* in case anyone was wondering why this was needed to begin with - some code I wrote a while ago was doing a deep copy on some different objects by doing a MemberwiseClone(), then selectively doing deep copies on reference types in that object. This worked OK until I recently found that during the MemberwiseClone() call, an event from a base object was bringing all it's handlers with it when copied. D'oh! I wanted a way to clear out the event after copying - but it was better to rewrite the copy code to work correctly than to continue with a bad idea implemented because of a time crunch.

-----
In the land of the blind, the one eyed man is king.
GeneralRe: Clearing event handlers Pin
Ed.Poore5-Apr-06 9:52
Ed.Poore5-Apr-06 9:52 
QuestionMDI Parent form with toolbars and menus Pin
snickel655-Apr-06 5:30
snickel655-Apr-06 5:30 
QuestionDoubleClick and MouseDown conflict Pin
cbeasle15-Apr-06 5:02
cbeasle15-Apr-06 5:02 
AnswerRe: DoubleClick and MouseDown conflict Pin
Judah Gabriel Himango5-Apr-06 5:07
sponsorJudah Gabriel Himango5-Apr-06 5:07 
GeneralRe: DoubleClick and MouseDown conflict Pin
cbeasle15-Apr-06 9:40
cbeasle15-Apr-06 9:40 
GeneralRe: DoubleClick and MouseDown conflict Pin
Judah Gabriel Himango5-Apr-06 12:12
sponsorJudah Gabriel Himango5-Apr-06 12:12 
GeneralRe: DoubleClick and MouseDown conflict Pin
h_sarandy8-Oct-10 20:46
h_sarandy8-Oct-10 20:46 
QuestionBrowsing to a location and selecting a file Pin
naglbitur5-Apr-06 4:31
naglbitur5-Apr-06 4:31 
AnswerRe: Browsing to a location and selecting a file Pin
V.5-Apr-06 4:37
professionalV.5-Apr-06 4:37 
AnswerRe: Browsing to a location and selecting a file Pin
J4amieC5-Apr-06 4:41
J4amieC5-Apr-06 4:41 
QuestionBrowsing to a location and selecting a file Pin
naglbitur5-Apr-06 4:30
naglbitur5-Apr-06 4:30 
AnswerRe: Browsing to a location and selecting a file Pin
Antony M Kancidrowski5-Apr-06 4:42
Antony M Kancidrowski5-Apr-06 4:42 
QuestionImport/Export registry section as xml file using C# code.. Pin
visala5-Apr-06 0:46
visala5-Apr-06 0:46 
QuestionWebservices & C# Pin
hung_ngole5-Apr-06 0:37
hung_ngole5-Apr-06 0:37 
AnswerRe: Webservices & C# Pin
Judah Gabriel Himango5-Apr-06 5:39
sponsorJudah Gabriel Himango5-Apr-06 5:39 
Question.net Language Interoperability Pin
smadan5-Apr-06 0:12
smadan5-Apr-06 0:12 
AnswerRe: .net Language Interoperability Pin
Erich Ledesma30-Mar-10 23:39
Erich Ledesma30-Mar-10 23:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.