passing this as parameter in static method

前端 未结 1 389
无人共我
无人共我 2021-01-23 21:16

I\'m having some trouble with some code in Visual C# for Windows Phone The trouble is not that it does not work, because it does, but I don\'t understand how =P Within a static

相关标签:
1条回答
  • 2021-01-23 21:55

    This is a so called extention method to the Timeline object. It adds functionallity without modifying the class itself.

    http://msdn.microsoft.com/en-us/library/bb383977.aspx

    And in your case the animation parameter is the Timeline object (which is calling the function):

    var timeLine = new Timeline();
    timeLine.MethodTwo();
    

    So the timeLine object will be passed as the animation parameter into the function. There's a nice article on wikipedia which explains it futher in detail:

    http://en.wikipedia.org/wiki/Extension_method

    0 讨论(0)
提交回复
热议问题