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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:20:29+00:00 2026-06-13T07:20:29+00:00

I need a multidimensional data structure with a row and a column. Must be

  • 0

I need a multidimensional data structure with a row and a column.

  • Must be able to insert elements any location in the data structure. Example: {A , B} I want to insert C in between A and B. {A, C, B}.
  • Dynamic: I do not know the size of the data structure.
  • Another example: I know the [row][col] of where I want to insert the element. EX. insert("A", 1, 5), where A is the element to be inserted, 1 is the row, 5 is the column.

EDIT
I want to be able to insert like this.

    static void Main(string[] args)
    {
        Program p = new Program();
        List<List<string()>> list = new List<List<string>()>();
        list.Insert("RAWR", 1, 2); // RAWR is the element to insert, 1 is the row, 2 is the col.
        list.Insert("Hello", 3, 5);
        for (int i = 0; i < list.Count; i++)
        {
            Console.WriteLine(list[i]);
        }
        Console.ReadKey();
    }

And of course this does not work, because the list does not support this functionality. I understand this code is bad, but I just want to get across what I am trying to accomplish.

So in a sense I will have a user who will choose which ROW and COL to insert the element to.

  • 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-13T07:20:31+00:00Added an answer on June 13, 2026 at 7:20 am

    I think a list of lists should work fine:

    IList<IList<T>> multiDim = new List<IList<T>>();
    

    You can insert new rows like this:

    multiDim.Insert(atRow, new List<T>());
    

    or insert a new element in a specific row:

    multiDim[row].Insert(atColumn, myElement);
    

    Note that you need to have enough elements in your list in order to call an Insert; otherwise, you will get an out-of-range exception. The easiest way to address this is to write a small utility method that adds empty items until the insertion is possible:

    private static Expand<T>(IList<T> list, int index) {
        while (list.Count < index) {
            list.Add(default(T));
        }
    }
    

    Rewrite your program as follows:

    Expand(list, 1);
    list.Insert(1, "HELLO");
    Expand(list, 5);
    list.Insert(5, "RAWR");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some multidimensional data structures that I need to do some interpolation on.
I need a dictionary-like data structure that stores information as follows: key [value 1]
I have CSV data loaded into a multidimensional array. In this way each row
I've got a multidimensional associative array which includes an elements like $data[status] $data[response][url] $data[entry][0][text]
I need to build a multidimensional array from records retrieved from my database. Here
I have a task where i need to write a multidimensional array to HDFS.
Need a map reduce function by mongo in php This my mongo structure [_id]
Need to set some attributes of button. For example Checked. I guess it is
I need to take a csv file and import this data into a multi-dimensional
I need to store multi-dimensional data consisting of numbers in a manner thats easy

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.