Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8304327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:48:57+00:00 2026-06-08T17:48:57+00:00

I would be grateful if somebody tell me how should I declare a dynamic

  • 0

I would be grateful if somebody tell me how should I declare a dynamic multidimensional array in ref class? Can somebody post a sample code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:49:00+00:00Added an answer on June 8, 2026 at 5:49 pm

    If you can afford array reallocations, then use the array type.

    You can either use the “array of arrays” construction

    /// Declaration
    array<array<SomeType>^>^ arr;
    
    /// Inititalization
    
    arr = gcnew array<array<SomeType>^> (NumElts1);
    
    for(int i=0 ; i < NumElts1 ; i++)
    {
      arr[i] = gcnew array<SomeType> (NumElts2);
    }
    

    or just the multidimensional ones:

    array<SomeType, NumDims> ^ Arr =
            gcnew array<SomeType, NumDims>(NumElts1, NumElts2, ....);
    

    Everything is garbage-collected so you don’t worry about destroying them.

    If you really need the “dynamic” arrays, then you might look for System.Collections.Generic.List<T> and use “List of Lists”. Lists have the ToArray() method.

    EDIT:

    The array type in C++/CLI is a template:

    template<typename T, int NumDims = 1>
    ref class array: System::Array
    {
        // black magic here
    }
    

    So you may use it for 1D-array without second argument.

    array<SomeType>^ Arr = gcnew array<SomeType>(SizeOfThisArray);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If anyone can help me I would be grateful! It should be converted the
would somebody tell me, how to from text in variable like: >Hello World text,1000
I am a bit novice in xml schema. I would be grateful if somebody
I'm studying Digital Image Processing by myself and would be really grateful if somebody
I would be really grateful if somebody could help me out with this.. I
I'm not the best at PHP and would be extremely grateful if somebody could
I would be grateful if somebody could help me to find an elegant solution
I would be grateful if somebody could help me out with the following problem.
I am actually new at Qt and would be grateful if someone could explain
Rails 3.1.3 and/or 3.2.2. I am unable to determine the cause, would be grateful

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.