Ram Prasad

Ram Prasad

  • NA
  • 326
  • 18.1k

variable for foreach loop

Aug 1 2018 11:35 PM
My current code kind of looks like code below (details excluded). I would like to capture the output of the for each loop into a variable so that I can use it further in the program. Please guide.
  1. static void Main(string[] args)  
  2. {  
  3. foreach (example)  
  4. {  
  5. if (condition 1)  
  6. {  
  7. }  
  8. if (condition 2)  
  9. {  
  10. }  
  11. if (condition 3)  
  12. { PrintServieChar();  
  13. }  
  14. Console.WriteLine(Environment.NewLine);  
  15. }  
  16. }

Answers (5)