Show/Hide Toolbars

XSharp

Fixed size buffers can only be accessed through locals or fields

 

A new feature in X# 2.0 is the ability to define an in-line array inside of a struct. Such arrays can only be accessed via local variables or fields, and may not be referenced as intermediate values on the left-hand side of an expression. Also, the arrays cannot be accessed by fields that are static or readonly.

 

To resolve this error, define an array variable, and assign the in-line array to the variable. Or, remove the static or readonly modifier from the field representing the in-line array.

Example

 

The following sample generates XS1708.

 

 

// XS1708.prg  
// compile with: /unsafe