Multidimensional array syntax

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Bernhard Mayer
Posts: 52
Joined: Thu Oct 06, 2016 3:00 pm
Location: Austria

Multidimensional array syntax

Post by Bernhard Mayer »

Dear fellow X#'ers!

In times of collections and lists I barely have any need for it but what's the syntax for creating and initializing a multidimensional .NET array?

I tried something like

Code: Select all

LOCAL aData AS STRING[,]
aData := <STRING>{  {"OneOne", "OneTwo"}, {"TwoOne", "TwoTwo"} } // Doesn't work
aData := STRING[,]{2,2} {  {"OneOne", "OneTwo"}, {"TwoOne", "TwoTwo"} } // Nor this
aData := STRING[,]{2,2} {  <STRING>{"OneOne", "OneTwo"}, <STRING>{"TwoOne", "TwoTwo"} } // Nor this
It's very embarrassing but what is the correct syntax?

TIA,
Bernhard
(X# 2.9)
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Multidimensional array syntax

Post by Chris »

Hi Bernhard,

Actually your 2nd version of the initializer does compile and run fine :)
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Bernhard Mayer
Posts: 52
Joined: Thu Oct 06, 2016 3:00 pm
Location: Austria

Multidimensional array syntax

Post by Bernhard Mayer »

Interesting, it does compile now ... well, the problem is definitely located before the computer :oops:

THX & best regards,
Bernhard
User avatar
Chris
Posts: 4898
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Multidimensional array syntax

Post by Chris »

To be honest, I was about to open a ticket about none of those 3 versions working here either, until I realized the 2nd one does work in the last moment :)
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply