Wednesday, June 1, 2011

"foreach" statement in c#

"ForEach" Statement helps the loop to run without any declaration for length
It also Reduces the the code by not declaring any variable which can check for Length


Eg:


string [] Emp_names = {"raj","Kumar","Joe","Mark","christie"};


 foreach ( string names in Emp_names)
  {
      console.writeline(names);
  }

No comments:

Post a Comment