What is "this" in Form correspond in WPF?
The "this" that we use in Form application. What does it correspond to in WPF? Is it MainWindow? I am using a library that is build around Form applicatio开发者_StackOverflown and there are alot of "this" and I don't know how to convert the "this" in WPF
In C#, this
is always a reference to the current instance of the class in which it is used.
In fact, to quote from MSDN:
The this keyword refers to the current instance of the class.
The following are common uses of this:
To qualify members hidden by similar names
To pass an object as a parameter to other methods
To declare indexers
Examples can be found following the link above.
There is an exception to this rule when working with extension methods, however, where this
is a modifier to the type of object by which the extension method is to be exposed.
this is always the class that it is in
think of it as this is in this class
精彩评论