Show/Hide Toolbars

XSharp

Property, indexer, or event 'property' is not supported by the language; try directly calling accessor method 'accessor'

 

Your code is consuming an object that has a default indexed property and tried to use the indexed syntax. To resolve this error, call the property's accessor method. For more information on indexers and properties, see Indexers.

 

The following sample generates XS1546.

Example

 

This code sample consists of a .cpp file, which compiles to a .dll, and a .prg file, which uses that .dll. The following code is for the .dll file, and defines a property to be accessed by the code in the .prg file.

 

 

// CPP1546.cpp  
// compile with: /clr /LD  
using namespace System;  
public ref class MCPP  
{  
public:  
   property int Prop [int,int]  
   {  
       int get( int i, int b )  
       {  
           return i;  
       }  
   }  
};  

 

Example

 

This is the X# file.

 

 

// XS1546.prg  
// compile with: /r:CPP1546.dll