1

In managed C++/CLI we create an array of string like below :

cli::array<String^> ^arr = gcnew cli::array<String^>{};

Now how create multidimensional string array in managed C++/CLI?
Mean:

string[][]

1 Answer 1

3
// 3 rows, 2 colums, that is rank 2    
array<String^,2>^ ar = gcnew array<String^,2>(3,2);
ar[0,0] = "row 0, column 0";
ar[2,0] = "row 2, column 1";

As an alternative you can use jagged arrays

// 3 rows
array<array<String^>^>^ ja = gcnew array<array<String^>^>(3); 
// Last row with 2 members
ja[2] = gcnew array<String^>(2);
ja[2][1] = "row 2, column 1"

But jagged arrays are defined different in C#

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.