#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    1
    Rep Power
    0

    Question Subscribe an event, it works without those virtual methode


    Hi this björn,
    (there is still an other forum , where I put this question, but it is a forum just for their owen books, so I dont think to get an answer there)

    I'm using this example, cause it overrides an event.
    http://developer.51cto.com/art/201308/407955_1.htm

    After I thought I'm fine now, I had to recognized, that nothing changed, when it runs without virtual and comment for those sub-methods

    That means, this methode without virtual:

    Code:
    protected void OnShapeChanged(ShapeEventArgs e)
    {
    // Make a temporary copy of the event to avoid possibility of
    // a race condition if the last subscriber unsubscribes
    // immediately after the null check and before the event is raised.
    EventHandler<ShapeEventArgs> handler = ShapeChanged;
    if (handler != null)
    {
    handler(this, e);
    }
    }
    and those both are comment
    protected override void OnShapeChanged(ShapeEventArgs e)
    {
    // Do any circle-specific processing here.

    // Call the base class event invocation method.
    base.OnShapeChanged(e);
    }


    There are no more changes like that.
    I have expect any error or a mistake about "sender", but there isnt.

    I'm sure override those event is needed, but I dont see it

    hopefully björn
    Last edited by björnWbl; November 28th, 2013 at 07:33 PM. Reason: other forum where i put it

IMN logo majestic logo threadwatch logo seochat tools logo