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!!