xsharp.eu • Simple question about arrays
Page 1 of 1

Simple question about arrays

Posted: Sun Feb 11, 2018 8:19 pm
by jacekm23
How can I define table of 256 bytes.

In C# I can write:

Byte[] data = new Byte[256];

In X#:

Local data as Byte[]
data := ?

Jacek

Simple question about arrays

Posted: Sun Feb 11, 2018 9:00 pm
by robert
Jacek,

In general you can change the C# code

new <type>(params)

to X# :

<type>{params}

so:

data := BYTE[]{256}

Robert

Simple question about arrays

Posted: Mon Feb 12, 2018 7:12 am
by wriedmann
Hi Jacek,

you can find this answer also here:

https://docs.xsharp.it/doku.php?id=net_array

Wolfgang

Simple question about arrays

Posted: Mon Feb 12, 2018 8:51 am
by Otto
Hi Wolfgang,

Nice article. Maybe you should mention also that the old VO arrays use USUALs and makes the performance lower than that of typed .NET arrays.
And that at compile time you lack the checks of the compiler.

Regards,
Otto

Simple question about arrays

Posted: Mon Feb 12, 2018 9:07 am
by wriedmann
Hi Otto,

thank you very much! I will add that today.

This documentation should be a community effort, and suggestions like yours help to make it better.

And of course we welcome everyone that is willing to contribute!

Wolfgang

Simple question about arrays

Posted: Mon Feb 12, 2018 7:02 pm
by wriedmann
Hi Otto,

I have added a note to the topic - I hope this is what you intended.

https://docs.xsharp.it/doku.php?id=net_array

Wolfgang