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

TOPIC: Creating an empty .net array: syntax?

Creating an empty .net array: syntax? 10 months 2 weeks ago #6099

  kitz's Avatar Topic Author kitz Offline Posts: 16
Hi!
How do I create an empty .net array with count of elements out of a variable?
VO:
local aArray as array
iElements := 100
aArray := ArrayCreate( iElements )

X#:
local aX as string[]
iElements := 100
aX := ???

I am aware of
aX := <string>{"Alpha", "Beta"}
but how do I create one without literals?

BR Kurt

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

Creating an empty .net array: syntax? 10 months 2 weeks ago #6100

  wriedmann's Avatar wriedmann Offline Posts: 1631
Hi Kurt,
aData := string[]{ 10 }

Please see also here: 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.

Creating an empty .net array: syntax? 10 months 2 weeks ago #6103

  kitz's Avatar Topic Author kitz Offline Posts: 16
Thanks Wolfgang!
Now it works!
Was already looking in these docs, but blind...
I had tried aX := <string[]>{ iElements }
There I got "cannot implicitly convert type 'int' to 'string[]'

BR Kurt

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

Creating an empty .net array: syntax? 10 months 2 weeks ago #6104

  wriedmann's Avatar wriedmann Offline Posts: 1631
Hi Kurt,

the wiki has a search box in the upper right corner <g>.

Put "array" there and click on the search button. The correct article will be at top with 15 hits.

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