Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to write a code that will help me in accessing the objects from the 2nd level and 3rd level of the dictionary.

Dictionary<string,>>>
I have something of this form now.

using (StreamReader r = new StreamReader(@"C:\Users\xyz.csv"))
{
string line;
line = r.ReadLine();
while (!string.IsNullOrEmpty(line))
{
line = r.ReadLine();
}
string[] sHeaders = line.Split(',');
int iIndex = Array.IndexOf(sHeaders, "RollNo");
while ((line = r.ReadLine()) != null)
{
string[] records = line.Split(',');
string sname = records[iIndex];
foreach (string record in records)
{

while(!string.IsNullOrEmpty(sname))
{
Dictionary<string,>> columns = new Dictionary<string,dictionary><string,string>>();


// Dont know what to do here
}
}

}
xyz.csv

RollNo Name Subject1
1 abc 90
2 xyz 80
3 pqr 92
//emptyline
RollNo Name Subject2
1 abc 98
2 xyz 86
3 pqr 88
//emptyline
RollNo Name Subject3
1 abc 99
2 xyz 83
3 pqr 82
Any help will be greatly appreciated .. Thanks in advance!!
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900