problem with list and arrays

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jitupatil2007
    New Member
    • Mar 2008
    • 6

    problem with list and arrays

    hi friends i am reading a csv file using string array and after that to keep a validation check i have added the array to list and using list i am accessing the records correctly but i have a problem when i keep a validation check then i can't get the desired output i have written the code like :
    Code:
    StreamReader sr = new StreamReader(@"C:\Documents and Settings\jitendra\Desktop\Copy of ric_mar.csv");
                StreamWriter sw = new StreamWriter(@"C:\dates.txt");
    
                string dates = "";
                string[] dvalue = null;
                IList<string> list = new List<string>();
    while (!sr.EndOfStream)
                {
                    dates = sr.ReadLine();
                    dvalue = dates.Split(',',';');
                    if (dvalue.Length > 3)
                    {
                        list.Add(dvalue[0].Replace("\"",""));
                    }
                }
    
                DateTime start = new DateTime(2008, 3, 1);
                DateTime end = new DateTime(2008 / 3 / 9);
                DateTime datevalue = DateTime.ParseExact(list[0], "MM/dd/yyyy HH:mm:ss", null);
     foreach (string var in list)
                {
                  sw.WriteLine(var.ToString());
                }
     sw.Flush();
                 sw.Close();
               
            }
            
            }
    i want to print the records which come between 03/01/2008(mmddyyyy) and 03/09/2008 but the problem is i am not able to traverse the list properly can anbody help me please....
  • ShahbazAshraf
    New Member
    • Mar 2008
    • 36

    #2
    Can u elaborate ur question further ? becoz u r accessing the list like

    foreach (string var in list)
    {
    sw.WriteLine(va r.ToString());
    }

    wht u want further ?

    Comment

    Working...