Guest User

Guest User

  • Tech Writer
  • 56
  • 1.9k

Execute action per each item on a list

May 16 2016 3:34 PM
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)