开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜