C# tutorial : this reference



C# tutorial : this reference implies current instance of class, to declare indexers and as first parameter of extension method.

this reference in C# facts:

  • this keyword can be used to access members from within constructors, instance methods, and instance accessors.
  • Static functions do not have this reference

Uses for this reference

  • to qualify members hidden by similar name

public method(string name)


this.name  = name;


  • to pass object as parameter to methods


  • to declare indexers

public int this[int param] { get; set; }

  • to declare extension method

public static int WordCount(this String str) { }

2 thoughts on “C# tutorial : this reference

  1. Pingback: Quibids.com

  2. Pingback: maillot psg 2013

Leave a Reply

Your email address will not be published. Required fields are marked *