Link to home
Start Free TrialLog in
Avatar of ocaccy
ocaccyFlag for Japan

asked on

Concatenate in C#.

Hello everyone.

I have a very pertinent question.

My x.ini file has the following indices; 8760 if not leap year and 8784 for leap year:

csv_day_hour

csv_001_01=value
csv_001_02=value
csv_001_03=value
csv_001_04=value
...
I need to load these values into an string array.
I'm trying to populate the array with a for loop.

If use "Settings.csv.[" **.[**  the error message is this:  Identifier expected      
If use "Settings.csv[" **[**  the error message is this: Settings.csv' is a 'type', which is not valid in the given context

Any help please.
ocaccy

        private void getMonthHour()
            {
            if(File.Exists(ConfigINI))
                {
                IniFile ini=new IniFile(ConfigINI);
                
                #region Populate the array
                for(int d=1;d<=365;d++) //I'll put the code to not leap years.
                    {
                    for(int h=1;h<=24;h++)
                        {
                        if(d<10)
                            {
                            if(h<10) { sMntHour[d,h]=Settings.csv.["csv_00"+d.ToString()+"_0"+h.ToString()]; }
                            else { sMntHour[d,h]=Settings.csv.["csv_00"+d.ToString()+"_"+h.ToString()]; }
                            }

                        else if (d>10&&d<100)
                            {
                            if(h<10) { sMntHour[d,h]=Settings.csv.["csv_0"+d.ToString()+"_0"+h.ToString()]; }
                            else { sMntHour[d,h]=Settings.csv.["csv_0"+d.ToString()+"_"+h.ToString()]; }
                            }

                        else
                            {
                            if(h<10) { sMntHour[d,h]=Settings.csv.["csv_"+d.ToString()+"_0"+h.ToString()]; }
                            else { sMntHour[d,h]=Settings.csv.["csv_"+d.ToString()+"_"+h.ToString()]; }
                            }
                        }
                    }
                #endregion // Populate the array
                }
            }

Open in new window


User generated image
ASKER CERTIFIED SOLUTION
Avatar of Luis Pérez
Luis Pérez
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ocaccy

ASKER

Hi Luis,

This help me; bit has problem on concatenation.
Avatar of ocaccy

ASKER

Hi Luis, Thís help me, but in the concatenation has problem.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ocaccy

ASKER

Hi Jaime, is because i don't know the sintax.
Avatar of ocaccy

ASKER

This is good!