Show/Hide Toolbars

XSharp

An object reference is required for the nonstatic field, method, or property 'member'

 

In order to use a non-static field, method, or property, you must first create an object instance. For more information about static methods, see Static Classes and Static Class Members. For more information about creating instances of classes, see Instance Constructors.

 

The following sample generates XS0120:

 

 

// XS0120_1.prg  
 

 

 

XS0120 will also be generated if there is a call to a non-static method from a static method, as follows:

 

 

// XS0120_2.prg  
// XS0120 expected  
 

 

Similarly, a static method cannot call an instance method unless you explicitly give it an instance of the class, as follows:

 

 

// XS0120_3.prg