2 Replies - 439 Views - Last Post: 06 October 2019 - 12:04 PM Rate Topic: -----

#1 valkenberg   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 22-February 17

What does the this. prefix mean in a method?

Posted 02 October 2019 - 12:04 AM

Consider the following code snippet please:

public delegate void myEvent(string textvalue);

Class CheckState
{
private string myString:
public event myEvent valueChanged;

public string Store
{
	   set {
		    this.myString = value;
                  this.valueChanged(myString)
	       }
       }
}



Can someone please enlighten me as to what the significance of the this is in this.myString and this.valueChanged? The only time I came across the this term before was to define an extension method and then the this was the 1st word in the extension method parameter list.

I tried to Google but was not able to find a proper definition and explanation.

I am still very much a newbie so your patience is much appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: What does the this. prefix mean in a method?

#2 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7105
  • View blog
  • Posts: 24,124
  • Joined: 05-May 12

Re: What does the this. prefix mean in a method?

Posted 02 October 2019 - 03:54 AM

Try searching Google harder with: "C# language this keyword".
Was This Post Helpful? 0
  • +
  • -

#3 valkenberg   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 58
  • Joined: 22-February 17

Re: What does the this. prefix mean in a method?

Posted 06 October 2019 - 12:04 PM

Got it, thanks.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1