Hi,
What is the main use of foreach in C# . Instead of using simple for loop. Is all .Net frame work support foreach.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Apr 9, 2014, 6:31 AM
This includes arrays and lists amongst other collections.
However, it can't be used to add or remove elements to or from the collection. You need to use an ordinary 'for' loop for this.