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

  • Home
  • SEARCH
  • 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 151789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:30:28+00:00 2026-05-11T09:30:28+00:00

In C#, i have created ArrayList using structures. so it creates multi dimensional array

  • 0

In C#, i have created ArrayList using structures. so it creates multi dimensional array list.

public struct ParameterValues {     public ArrayList al; };  ArrayList alCombined = new ArrayList();  for(int i=0; i < CONDITION , i++)     alCombined.Add(obj.pValue.al); 

The dimension of ArrayList alCombined depends on the CONDITION. if its 1, then 1-D arraylist is created. Else multidimensional Arraylist is getting created.

Now in order to access the elements of alCombined, i’m typecasting it and accessing, like

(((ArrayList)al[i])[j]) 

But if its a 1-D arraylist then error occurs as type casting to Arraylist is not possible.

So I need a solution for this, or how to find if its a single/ multi dimensional arraylist. FYI: it should not depend on CONDITION variable. like if d condition is more than one, then it will be multi dimensional for sure.

Thanks in advance.

  • 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. 2026-05-11T09:30:28+00:00Added an answer on May 11, 2026 at 9:30 am

    There’s really no such thing as a ‘multi-dimensional ArrayList’. ArrayLists don’t have a particular element type. You might have one element which is an integer, another which is a string, another which is an int[] and another which is an ArrayList itself.

    A few suggestions on your code:

    • Mutable structs are a bad idea. Avoid them. Chances are you don’t really want a struct in the first place, and mutable structs can cause all kinds of unexpected behaviour.
    • Public fields are a bad idea. Avoid them. Fields are an implementation detail, and shouldn’t be part of the API.
    • ArrayList is effectively deprecated – use generic collections instead. That will make the type information much more clearer.
    • You should design your data structure so that you don’t get into this sort of situation. Ideally, there should be very few execution-time type checks going on in your code. Perhaps if you could give us more information on what you’re trying to achieve, we could help you redesign it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 146k
  • Answers 146k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It isn't an attribute, can you do this: (don't have… May 12, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer Marc is correct about putting the assembly name after the… May 12, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer You could use the Oracle REPLACE function: UPDATE table SET… May 12, 2026 at 9:06 am

Related Questions

I have a structure in C#.net. I have created an object of that structure.
I created an ArrayList which contains KeyValuePair<string, string> objects. There are ListBoxes which I
Hi I have Card class... In another class I create an arrayList of Card
I want to fill items in a combobox, each of them has different behaviour.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.