Question about when and when not to raise events (C#)
        Posted  
        
            by NoPyGod
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by NoPyGod
        
        
        
        Published on 2010-05-14T00:26:13Z
        Indexed on 
            2010/05/14
            0:34 UTC
        
        
        Read the original article
        Hit count: 307
        
I am programming an instant messaging library for MSN Messenger, and I have a simple question about raising events.
When logging in, should I be raising UserAdded for each user that is synchronized (already on the contact list), or should the UserAdded event be reserved for when a new user has been added to the contact list via the AddUser method? Should I perhaps use another event, UserDownloaded for when a user is downloaded?
Similarly, when I call logout, should I call UserRemoved?
I hope this makes sense.
Thank you
© Stack Overflow or respective owner