Dinesh Santhalingam

Dinesh Santhalingam

  • NA
  • 737
  • 367.4k

data table to dictionary

Dec 23 2016 5:25 AM
I have a data table .i want to load my entire data table to my dictionary without reading each row every time.suggest me some ideas?
 


  1. data table dt=new data table();
//I have some data in my table
  1. Dictionary<string, object> lst = new Dictionary<string, object>();  
  2.   
  3. try  
  4. {  
  5. lst.Add(row["Time"].ToString(), row["Inuse"] as string);
  6. }  
  7. catch (Exception ex)  
  8. {  
  9.     throw ex;  
  10. }  
  11.   
  12. return lst;  

 I tried this.But i want to load data table without using foreach loop .

Answers (3)