Simple question about arrays

This forum is meant for questions and discussions about the X# language and tools
Post Reply
jacekm23
Posts: 16
Joined: Tue Sep 29, 2015 8:45 am
Location: Poland

Simple question about arrays

Post 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
User avatar
robert
Posts: 4529
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Simple question about arrays

Post by robert »

Jacek,

In general you can change the C# code

new <type>(params)

to X# :

<type>{params}

so:

data := BYTE[]{256}

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Simple question about arrays

Post by wriedmann »

Hi Jacek,

you can find this answer also here:

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

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

Simple question about arrays

Post 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
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Simple question about arrays

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
wriedmann
Posts: 3757
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

Simple question about arrays

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply