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 8174513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:28:45+00:00 2026-06-06T22:28:45+00:00

This code gives me this error:Cannot implicitly convert type ArrayList[] to ArrayList[][] at this

  • 0

This code gives me this error:”Cannot implicitly convert type ArrayList[] to ArrayList[][]” at this line: m_grid[gridIndexX] = new ArrayList[Height]; But how can i do that in another way? When m_grid array is a two dimensional array it works but as a three dimensional array it doesn’t work.Thanks for help.

private ArrayList[][][] m_grid;
private void initialize() {
    Width           = 5;
    Height          = 5;
    Depth           = 5;
    m_grid = new ArrayList[Width][][];
}
public void Refresh(ref ArrayList particles) {

        m_grid = null;
        m_grid = new ArrayList[Width][][];

        if (particles != null) {
            for (int i = 0; i < particles.Count; i++) {
                FluidParticle p = (FluidParticle) particles[i];
                int gridIndexX = GetGridIndexX(ref p);
                int gridIndexY = GetGridIndexY(ref p);
                int gridIndexZ = GetGridIndexZ(ref p);

                // Add particle to list
                if (m_grid[gridIndexX] == null) {
                    m_grid[gridIndexX] = new ArrayList[Height];
                }
                if (m_grid[gridIndexX][gridIndexY][gridIndexZ] == null) {
                    m_grid[gridIndexX][gridIndexY][gridIndexZ] = new ArrayList();
                }
                m_grid[gridIndexX][gridIndexY][gridIndexZ].Add(i);
            }
        }
    }
  • 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-06T22:28:47+00:00Added an answer on June 6, 2026 at 10:28 pm

    You need to add another indexer. You’ve initialized m_grid as a 3-dimentional array. So any first-level element within m_grid is a 2-dimensional array. And you’re trying to set one of those elements to a 1-dimensional array:

    m_grid[gridIndexX] = new ArrayList[Height];
    

    In the above code, m_grid[gridIndexX] is of type ArrayList[][], so you have a type mis-match.

    You’ll need to set it to the proper type:

    m_grid[gridIndexX] = new ArrayList[Height][];
    

    I don’t know if this alone will solve your problem, because it’s difficult to discern what this code is actually supposed to do. (Indeed, if you’re not sure what parts of your code are what dimensionality of arrays, I’m not sure if you even know what this code is supposed to do…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code gives me this error: Cannot convert from 'System.Collections.Generic.List' to 'System.Collections.Generic.List'. How
The following code gives me the errors: Cannot implicitly convert type T to string.
I'm trying this code to access a property but it gives me an error:
This code gives error C2504: 'IKeyEvent': base class undefined on line 3. class IKeyEvent;
i want to fill in fields with this code but it gives me error
This piece of code gives a syntax error at the colon of elif process.loop(i,
I have this in my code: SelectList(blah, blah, blah, cu.Customer.CustomerID.ToString()) It gives a error
In this code, for vector size, n >=32767, it gives segmentation fault, but upto
I was testing Thrift on java, but this code give me some errors.. ClientVoiceToTextHandler
This code gives me an empty result. I expect it to print out the

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.