Reputation: 689
Question : What can be the C# equivalent of Java Class.this
?
Why : Suppose I've same class Form1 in both Java and C#. In Java we can write Form1.this
, how this can be written in C#.
Upvotes: 3
Views: 2615
Reputation: 67439
There is no equivalent, C# has no nested class support where it also tracks outer instances. If needed you pass a pointer yourself and store it in a field/property.
If all you want is the normal this
to reference members in the same instance, simply use the this
keyword. Or even better, don't -- it's implied.
Upvotes: 11