fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Simple question about arrays

Simple question about arrays 1 year 1 month ago #1

  • jacekm23
  • jacekm23's Avatar Topic Author
  • Offline
  • Posts: 5
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

Please Log in or Create an account to join the conversation.

Simple question about arrays 1 year 1 month ago #2

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
This email address is being protected from spambots. You need JavaScript enabled to view it.

Please Log in or Create an account to join the conversation.

Simple question about arrays 1 year 1 month ago #3

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1436
  • Karma: 6
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Simple question about arrays 1 year 1 month ago #4

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

Please Log in or Create an account to join the conversation.

Simple question about arrays 1 year 1 month ago #5

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1436
  • Karma: 6
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

Simple question about arrays 1 year 1 month ago #6

  • wriedmann
  • wriedmann's Avatar
  • Away
  • Posts: 1436
  • Karma: 6
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
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

Please Log in or Create an account to join the conversation.

  • Page:
  • 1