Регулярные короткие заметки по C# и .NET.
Просто о сложном для каждого.
admin - @haarrp
Post #281
1.13K
Foreach Loop in C# (part 2)
Important Points:
🔸 The foreach loop iterate only in forward direction.
🔸 Performance wise foreach loop takes much time as compared with for loop.
🔸 Because internally it uses extra memory space as well as.
🔸 The foreach loop use
🔸 Exit the foreach loop by using break, return, Goto and throw.
The following example demonstrates the foreach loop on a dictionary collection.
Important Points:
🔸 The foreach loop iterate only in forward direction.
🔸 Performance wise foreach loop takes much time as compared with for loop.
🔸 Because internally it uses extra memory space as well as.
🔸 The foreach loop use
GetEnumarator() method of the IEnumerable interface. So, the foreach loop can be used with any class that has implemented the interface.🔸 Exit the foreach loop by using break, return, Goto and throw.
The following example demonstrates the foreach loop on a dictionary collection.


