ocaccy
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
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
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Luis, Thís help me, but in the concatenation has problem.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Jaime, is because i don't know the sintax.
ASKER
This is good!
ASKER
This help me; bit has problem on concatenation.