| c# Programming Glossary: subscriberIs there a downside to adding an anonymous empty delegate on event declaration? http://stackoverflow.com/questions/170907/is-there-a-downside-to-adding-an-anonymous-empty-delegate-on-event-declaration  mentions of this idiom including on SO Deliberately empty subscriber public event EventHandler AskQuestion delegate The upside is.. there any appreciable performance hit of the empty event subscriber call  c# coding style delegates events idioms   share improve.. 
 Weak event handler model for use with lambdas http://stackoverflow.com/questions/1747235/weak-event-handler-model-for-use-with-lambdas  you just want the event handler to detach itself when your subscriber falls out of scope this answer is for you.  c# .net events memory.. but it works . h control.MouseDown h h control.MouseDown h subscriber s e s.DoSomething e See note below for generic events SetAnyHandler.. h control.ValueEvent h h control.ValueEvent h subscriber s e s.DoSomething e See note below This is a workaround from.. 
 Why and How to avoid Event Handler memory leaks? http://stackoverflow.com/questions/4526829/why-and-how-to-avoid-event-handler-memory-leaks  the publisher of the event holds a reference to the subscriber via the event handler delegate assuming the delegate is an instance.. instance method . If the publisher lives longer than the subscriber then it will keep the subscriber alive even when there are no.. lives longer than the subscriber then it will keep the subscriber alive even when there are no other references to the subscriber... 
 Collection was modified; enumeration operation may not execute http://stackoverflow.com/questions/604831/collection-was-modified-enumeration-operation-may-not-execute  times per day . When a Windows Forms client subscribes the subscriber ID is added to the subscribers dictionary and when the client.. Forms client subscribes the subscriber ID is added to the subscribers dictionary and when the client unsubscribes it is deleted from.. private static IDictionary Guid Subscriber subscribers public SubscriptionServer  subscribers new Dictionary Guid.. 
 Use of null check in event handler http://stackoverflow.com/questions/672638/use-of-null-check-in-event-handler  the event publisher ends up with a reference to the event subscriber i.e. the target of the handler . This is only a problem if the.. 
 Queuing in OneWay WCF Messages using Windows Service and SQL Server http://stackoverflow.com/questions/9702379/queuing-in-oneway-wcf-messages-using-windows-service-and-sql-server  Integrating SQL Service Broker and NServiceBus Can a subscriber also publish send message in NServiceBus  c# asp.net .net sql.. 
 Event Signature in .NET — Using a Strong Typed 'Sender'? http://stackoverflow.com/questions/1046016/event-signature-in-net-using-a-strong-typed-sender  typed event handler that did not require casting class Subscriber void SomeEventHandler Publisher sender PublisherEventArgs e.. a traditional event handling signature if desired class Subscriber void SomeEventHandler object sender PublisherEventArgs e  if..   SomeEvent this new PublisherEventArgs   class StrongTypedSubscriber  public void SomeEventHandler Publisher sender PublisherEventArgs.. 
 Weak event handler model for use with lambdas http://stackoverflow.com/questions/1747235/weak-event-handler-model-for-use-with-lambdas  ValueEvent event for 'vanilla' events SetAnyHandler Subscriber MouseEventHandler MouseEventArgs h o e h o e don't ask me but.. e See note below for generic events SetAnyHandler Subscriber ValueEventArgs h control.ValueEvent h h control.ValueEvent h.. e or invoking DoSomething e directly if we are inside the Subscriber class. Doing this effectively creates a reference to subscriber.. 
 Is it necessary to explicitly remove event handlers in C# http://stackoverflow.com/questions/506092/is-it-necessary-to-explicitly-remove-event-handlers-in-c-sharp   else  Console.WriteLine No handlers  public class Subscriber public void FooHandler object sender EventArgs e  Console.WriteLine.. FooHandler object sender EventArgs e  Console.WriteLine Subscriber.FooHandler  public class Test static void Main  Publisher publisher.. Test static void Main  Publisher publisher new Publisher Subscriber subscriber new Subscriber publisher.Foo subscriber.FooHandler.. 
 Collection was modified; enumeration operation may not execute http://stackoverflow.com/questions/604831/collection-was-modified-enumeration-operation-may-not-execute  is a WCF server in a Windows service. The method NotifySubscribers is called by the service whenever there is a data event at.. unsubscribes. It appears that the next time the NotifySubscribers method is called the foreach loop fails with the error in the.. ISubscriptionServer private static IDictionary Guid Subscriber subscribers public SubscriptionServer  subscribers new Dictionary.. 
 Is the C# static constructor thread safe? http://stackoverflow.com/questions/7095/is-the-c-sharp-static-constructor-thread-safe 
 |