There is the following code:
Code: Select all
LOCAL a AS ARRAY OF MyClass
a := ArrayCreate<MyClass>(10)
Code: Select all
CLASS MyClass
CONSTRUCTOR(oSomeParam AS OBJECT) STRICT
END CLASS
Why does the generic version of ArrayCreate require a parameterless constructor?XS0310 'MyClass' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'T' in the generic type or method 'XSharp.RT.Functions.ArrayCreate<T>(dword)'
According to the documentation, the ArrayCreate function сreates an uninitialized, one-dimensional array. In the non-generic version, the array is filled with NIL. In the generic version, these should be NULL values. There is no need to create instances of the class.
For example, this code is similar to the following (which compiles without errors):
Code: Select all
LOCAL a AS MyClass[]
a := MyClass[]{ 10 }
Leonid