I have an array which really is a function, however i would like to use it as an array. I know i can write these
int var { get{return v2;} }
public int this[int v] { get { return realArray[v]; }
but how do i implement a function that like an array? i would like to do something like
public int pal[int i] { get { return i*2; } }
But that get a compile error
error CS0650: Bad array declarator: To declare a managed array the rank specifier precedes the variable's identifier. To declare a fixed size buffer field, use the fixed keyword before the field type.
error CS0270: Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)