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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:56:48+00:00 2026-05-16T23:56:48+00:00

I asked a question not too long ago about multi-dimensional and jagged arrays in

  • 0

I asked a question not too long ago about multi-dimensional and jagged arrays in C#. Well, I was trying the List class instead and was running into a bit of a jam. What happens is only a few of the values in wtflist actually make it to the end of Main(). How can I make sure all of the data gets in (and stays in) wtflist?

Edit: Here is my NEW code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleIometerParser
{
    class Program
    {
        public static int linenum = 0;
        public static int totaldisks = 0;
        public static int disk = 0;

        public static List<List<List<string>>> overallList = new List<List<List<string>>>();

        static int Main(string[] args)
        {
            string filename = args[0];
            string[] lines = System.IO.File.ReadAllLines(@filename);

            System.Console.WriteLine("Processing Data...");

            foreach (string line in lines)
            {
                string[] linearray;
                string lineNoQuotes;

                char[] delimiter = new Char[] { ',' };

                lineNoQuotes = line.Replace("\"", string.Empty);
                lineNoQuotes = lineNoQuotes.Replace("'", string.Empty);

                linearray = lineNoQuotes.Split(delimiter);
                totaldisks = (linearray.Length - 1) / 10;

                for (disk = 0; disk < totaldisks; disk++)
                {
                    List<List<string>> diskDataList = new List<List<string>>();
                    List<string> dataList = new List<string>();

                    dataList.Add("");
                    dataList.Add(args[1]);
                    dataList.Add(linearray[0]);

                    for (int i = 1; i < 10; i++)
                    {
                        int arraypos = disk + (i * totaldisks);
                        dataList.Add(linearray[arraypos].ToString());
                        diskDataList.Add(dataList);
                    }
                    overallList.Add(diskDataList);
                }
                linenum++;
            }

            int count1 = 0;
            int count2 = 0;
            int count3 = 0;

            foreach (var wtf in overallList)
            {
                foreach (var lol in wtf)
                {
                    foreach (var zomg in lol)
                    {
                        Console.WriteLine("overallList[{0},{1},{2}]: {3}", count1, count2, count3, zomg);
                        count3++;
                    }
                    count3 = 0;
                    count2++;
                }
                count2 = 0;
                count1++;
            }

            Console.WriteLine("Data Processed Successfully.");
            Console.Read();

            return 0;
        }
    }
}

New Output:

Processing Data...
overallList[0,0,0]:
overallList[0,0,1]: 1
overallList[0,0,2]: Column1
overallList[0,0,3]: Column4
overallList[0,0,4]: Column7
overallList[0,0,5]: Column10
overallList[0,0,6]: Column13
overallList[0,0,7]: Column16
overallList[0,0,8]: Column19
overallList[0,0,9]: Column22
overallList[0,0,10]: Column25
overallList[0,0,11]: Column28
overallList[0,1,0]:
overallList[0,1,1]: 1
overallList[0,1,2]: Column1
overallList[0,1,3]: Column5
overallList[0,1,4]: Column8
overallList[0,1,5]: Column11
overallList[0,1,6]: Column14
overallList[0,1,7]: Column17
overallList[0,1,8]: Column20
overallList[0,1,9]: Column23
overallList[0,1,10]: Column26
overallList[0,1,11]: Column29
overallList[0,2,0]:
overallList[0,2,1]: 1
overallList[0,2,2]: Column1
overallList[0,2,3]: Column6
overallList[0,2,4]: Column9
overallList[0,2,5]: Column12
overallList[0,2,6]: Column15
overallList[0,2,7]: Column18
overallList[0,2,8]: Column21
overallList[0,2,9]: Column24
overallList[0,2,10]: Column27
overallList[0,2,11]: Column30
overallList[1,0,0]:
overallList[1,0,1]: 1
overallList[1,0,2]: 07/08/10 03:04 PM
overallList[1,0,3]:
overallList[1,0,4]:
overallList[1,0,5]:
overallList[1,0,6]: 0
overallList[1,0,7]:
overallList[1,0,8]:
overallList[1,0,9]:
overallList[1,0,10]:
overallList[1,0,11]:
overallList[1,1,0]:
overallList[1,1,1]: 1
overallList[1,1,2]: 07/08/10 03:04 PM
overallList[1,1,3]:
overallList[1,1,4]:
overallList[1,1,5]: 0
overallList[1,1,6]:
overallList[1,1,7]:
overallList[1,1,8]:
overallList[1,1,9]:
overallList[1,1,10]:
overallList[1,1,11]:
overallList[1,2,0]:
overallList[1,2,1]: 1
overallList[1,2,2]: 07/08/10 03:04 PM
overallList[1,2,3]:
overallList[1,2,4]:
overallList[1,2,5]: 0
overallList[1,2,6]:
overallList[1,2,7]:
overallList[1,2,8]:
overallList[1,2,9]:
overallList[1,2,10]:
overallList[1,2,11]:
overallList[2,0,0]:
overallList[2,0,1]: 1
overallList[2,0,2]: 07/08/10 03:06 PM
overallList[2,0,3]: 98.6
overallList[2,0,4]: 0.02
overallList[2,0,5]: 0.02
overallList[2,0,6]: 0
overallList[2,0,7]: 508500.98
overallList[2,0,8]: 70684.4
overallList[2,0,9]: 10.91
overallList[2,0,10]: 30.66
overallList[2,0,11]: 437816.59
overallList[2,1,0]:
overallList[2,1,1]: 1
overallList[2,1,2]: 07/08/10 03:06 PM
overallList[2,1,3]: 0.02
overallList[2,1,4]: 0.02
overallList[2,1,5]: 0
overallList[2,1,6]: 501532.1
overallList[2,1,7]: 70684.4
overallList[2,1,8]: 10.91
overallList[2,1,9]: 29.84
overallList[2,1,10]: 430847.7
overallList[2,1,11]: 18.93
overallList[2,2,0]:
overallList[2,2,1]: 1
overallList[2,2,2]: 07/08/10 03:06 PM
overallList[2,2,3]: 0
overallList[2,2,4]: 0
overallList[2,2,5]: 0
overallList[2,2,6]: 6968.88
overallList[2,2,7]: 0
overallList[2,2,8]: 0
overallList[2,2,9]: 0.81
overallList[2,2,10]: 6968.88
overallList[2,2,11]: 0.81
overallList[3,0,0]:
overallList[3,0,1]: 1
overallList[3,0,2]: 07/08/10 03:07 PM
overallList[3,0,3]: 99.86
overallList[3,0,4]: 0
overallList[3,0,5]: 0
overallList[3,0,6]: 0
overallList[3,0,7]: 84469.57
overallList[3,0,8]: 273.07
overallList[3,0,9]: 0.07
overallList[3,0,10]: 6.14
overallList[3,0,11]: 84196.5
overallList[3,1,0]:
overallList[3,1,1]: 1
overallList[3,1,2]: 07/08/10 03:07 PM
overallList[3,1,3]: 0
overallList[3,1,4]: 0
overallList[3,1,5]: 0
overallList[3,1,6]: 78092.25
overallList[3,1,7]: 273.07
overallList[3,1,8]: 0.07
overallList[3,1,9]: 5.39
overallList[3,1,10]: 77819.18
overallList[3,1,11]: 5.32
overallList[3,2,0]:
overallList[3,2,1]: 1
overallList[3,2,2]: 07/08/10 03:07 PM
overallList[3,2,3]: 0
overallList[3,2,4]: 0
overallList[3,2,5]: 0
overallList[3,2,6]: 6377.32
overallList[3,2,7]: 0
overallList[3,2,8]: 0
overallList[3,2,9]: 0.76
overallList[3,2,10]: 6377.32
overallList[3,2,11]: 0.76
overallList[4,0,0]:
overallList[4,0,1]: 1
overallList[4,0,2]: 07/08/10 03:09 PM
overallList[4,0,3]: 99.83
overallList[4,0,4]: 0
overallList[4,0,5]: 0
overallList[4,0,6]: 0
overallList[4,0,7]: 35277.63
overallList[4,0,8]: 1849.23
overallList[4,0,9]: 0.32
overallList[4,0,10]: 5.1
overallList[4,0,11]: 33428.4
overallList[4,1,0]:
overallList[4,1,1]: 1
overallList[4,1,2]: 07/08/10 03:09 PM
overallList[4,1,3]: 0
overallList[4,1,4]: 0
overallList[4,1,5]: 0
overallList[4,1,6]: 25764.05
overallList[4,1,7]: 1576.11
overallList[4,1,8]: 0.29
overallList[4,1,9]: 4.05
overallList[4,1,10]: 24187.94
overallList[4,1,11]: 3.76
overallList[4,2,0]:
overallList[4,2,1]: 1
overallList[4,2,2]: 07/08/10 03:09 PM
overallList[4,2,3]: 0
overallList[4,2,4]: 0
overallList[4,2,5]: 0
overallList[4,2,6]: 9513.58
overallList[4,2,7]: 273.12
overallList[4,2,8]: 0.03
overallList[4,2,9]: 1.06
overallList[4,2,10]: 9240.46
overallList[4,2,11]: 1.02
overallList[5,0,0]:
overallList[5,0,1]: 1
overallList[5,0,2]: 07/08/10 03:10 PM
overallList[5,0,3]: 99.91
overallList[5,0,4]: 0
overallList[5,0,5]: 0
overallList[5,0,6]: 0
overallList[5,0,7]: 34662.41
overallList[5,0,8]: 182.04
overallList[5,0,9]: 0.03
overallList[5,0,10]: 4.92
overallList[5,0,11]: 34480.36
overallList[5,1,0]:
overallList[5,1,1]: 1
overallList[5,1,2]: 07/08/10 03:10 PM
overallList[5,1,3]: 0
overallList[5,1,4]: 0
overallList[5,1,5]: 0
overallList[5,1,6]: 25691.03
overallList[5,1,7]: 91.02
overallList[5,1,8]: 0.02
overallList[5,1,9]: 4.06
overallList[5,1,10]: 25600.01
overallList[5,1,11]: 4.03
overallList[5,2,0]:
overallList[5,2,1]: 1
overallList[5,2,2]: 07/08/10 03:10 PM
overallList[5,2,3]: 4.67E-005
overallList[5,2,4]: 0
overallList[5,2,5]: 0
overallList[5,2,6]: 8971.38
overallList[5,2,7]: 91.02
overallList[5,2,8]: 0.01
overallList[5,2,9]: 0.87
overallList[5,2,10]: 8880.36
overallList[5,2,11]: 0.86
Data Processed Successfully.

Here’s the OLD code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace ConsoleIometerParser
{
    class Program
    {
        public static int linenum = 0;
        public static int totaldisks = 0;
        public static int disk = 0;

        public static List<List<List<string>>> wtflist = new List<List<List<string>>>();

        //public static string[,,] sqlarray;

        static int Main(string[] args)
        {
            string filename = args[0];
            string[] lines = System.IO.File.ReadAllLines(@filename);

            System.Console.WriteLine("Processing Data...");

            foreach (string line in lines)
            {
                //Console.WriteLine("Linenum: " + linenum);
                string[] linearray;
                string lineNoQuotes;

                char[] delimiter = new Char[] { ',' };

                lineNoQuotes = line.Replace("\"", string.Empty);
                lineNoQuotes = lineNoQuotes.Replace("'", string.Empty);

                linearray = lineNoQuotes.Split(delimiter);
                totaldisks = (linearray.Length - 1) / 10;

                //sqlarray = new string[totaldisks, lines.Length, 13];

                for (disk = 0; disk < totaldisks; disk++)
                {
                    List<List<string>> lollist = new List<List<string>>();

                    //sqlarray[disk, linenum, 0] = ""; //blank field for the SQL id field
                    //sqlarray[disk, linenum, 1] = args[1]; //testid
                    //sqlarray[disk, linenum, 2] = linearray[0]; //time

                    for (int i = 1; i < 10; i++)
                    {
                        List<string> zomglist = new List<string>();

                        int arraypos = disk + (i * totaldisks);
                        //sqlarray[disk, linenum, i + 2] = linearray[arraypos].ToString();
                        //Console.WriteLine("sqlarray[{0},{1},{2}]: {3}", disk, linenum, i, sqlarray[disk, linenum, i]);
                        zomglist.Add(linearray[arraypos].ToString());

                        Console.WriteLine("zomglist data: {0}", zomglist.Last());

                        if (i == 9) lollist.Add(zomglist);
                    }
                    wtflist.Add(lollist);
                }
                linenum++;
            }

            foreach (var wtf in wtflist)
            {
                foreach (var lol in wtf)
                {
                    foreach (var zomg in lol)
                    {
                        Console.WriteLine("ZOMG: " + zomg);
                    }
                }
            }


            Console.WriteLine("Data Processed Successfully.");
            Console.Read();

            return 0;
        }
    }
}
  • 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-05-16T23:56:48+00:00Added an answer on May 16, 2026 at 11:56 pm

    Your line: if (i == 9) lollist.Add(zomglist); means that only 1/10th (or every 10th) of the zomglists created will get added to the lollist. Looks like it’s executing perfectly to me.

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

Sidebar

Related Questions

I asked a very similar question not too long ago and got some great
I was asked this question not too long ago, and didn't have a good
Somebody asked similar question not long ago. But nobody answered comprehensively. Assume I have:
This is a follow-up question to a different question I asked not too long
I asked a similar question about this previously, but I did not specify that
(This question is asked on Maven User mailing list too) I have recently faced
My friend asked this question I am not sure why it is on my
I'm not sure if I asked the question correctly. I have some code I
I asked this question to multiple people and until now I do not have
I asked a question [ here ] recently and it's just not providing me

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.