5
Answers

variable for foreach loop

Ram Prasad

Ram Prasad

6y
672
1
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)