2
Reply

Execute action per each item on a list

Ask a question
Hi,
 
I got a bit stuck in trying to perfom an action per each item on a list.
 
I'm filling in the list with:
  1. HyperlinksDAL hl = new HyperlinksDAL();  
  2. hl.GetAll();  
HyperlinksDAL:
  1. public List<Hyperlink> GetAll()  
  2. {  
  3.     using (var context = new servicesEntities())  
  4.     {  
  5.         return context.Hyperlinks.ToList();  
  6.     }  
  7. }  
 And I figured I could use a foreach to then fill in a series for a chart like:
 
  1. foreach(var i in list)  
  2. {  
  3.          series.DataPoints.Add(new CategoricalDataPoint(500, "jan"));  
  4. }  
Regards. 

Answers (2)