C# this Keyword

tutorial and example
tutorial and example

In C#, this is a keyword used to refer current class instance. It is mainly used to distinguish instance variables of the class and formal parameters defined in a constructor call.

this can also be used to return current class object from a method.  It can also be passed in a method.

C# this keyword Example1:

C# this Keyword Example 2: calling current class method by this

Output

C# this Keyword Example 3: passing this in a method

Output

C# this keyword Example: Returning this from the method

Output