Export (0) Print
Expand All
Expand Minimize

JS1243: A non-static member is not accessible from a static scope

A static method or property accessed a non-static member of the class. Static class members are associated with the class itself and do have information about the members of a particular instance, while non-static members are associated with a particular instance. This means that static methods and properties cannot access non-static members.

Non-static members can be accessed indirectly by a static method when an instance of the class is passed to the method as an argument. The static method can access all the members of the class instance, including members marked with the private modifier.

To correct this error

  1. Change the modifiers so that both the accessed member and the member that accesses are either static or non-static.

  2. Pass an instance of the class to the static method.

Community Additions

ADD
Show:
© 2014 Microsoft