Pradeep Yadav
Can we use “this” within a static method?
By Pradeep Yadav in C# on May 24 2017
  • Gajendra Jangid
    Jan, 2018 29

    no. this keyword denote instance.....and static method does not support instance

    • 4
  • Kapil Gupta
    Nov, 2017 21

    No, this keyword denotes instance variables and functions. In static method, Only static properties initialize.

    • 3
  • Joy K
    Jun, 2018 7

    No, this keyword refers current instance of the class. Static methods do not have instance/object. Hence we can not use this keyword. We call a static method using ClassName.StaticMethodName

    • 2
  • Bharathi Raja
    Feb, 2018 1

    By static methods you can write:MyClass.static_method();

    • 2
  • Manav Pandya
    Jan, 2018 16

    Technically its not possible , because static portion execute before any other part of code o this keyword will be without referenced

    • 2
  • Pradeep Yadav
    May, 2017 24

    No, We can not use, we can only use static variables/methods in a static method.

    • 2
  • AKHILESH KUMAR
    Aug, 2018 2

    no

    • 1
  • Satish Sanaboyina
    Mar, 2018 15

    Static method doesnt allow "this" keyword.

    • 1
  • Satish Sanaboyina
    Mar, 2018 15

    Static method doesnt allow "this" keyword.

    • 1
  • Rajeev Kumar
    Mar, 2023 31

    No, this keyword refers current instance of the class. Static methods do not have instance/object. Hence we can not use this keyword.

    • 0
  • Binod Kumar
    Jun, 2019 28

    The answer is no because static method does not need any object to be called, and this keyword always point to a current object of a class. simply if there is no object then how the keyword point to any current object so,we cannot use this keyword here.

    • 0
  • kajal rane
    Apr, 2019 5

    No,This Keyword Refer to Current Insance only, and static method or properties are not belong to any particular instance ,static is common for all insances

    • 0
  • Vipin Kumar
    Mar, 2019 29

    No

    • 0
  • sushil kumar
    Mar, 2019 7

    No bcz we directly call method from class name.

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS