Can anyone give me some examples errors that may occur in execution time, compilation undetectable using the foreach structure in C#?
Can anyone give me some examples errors that may occur in execution time, compilation
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The most common it would be modifying your collection
you cannot modify your collection structure while enumerating through it.
You can modify the items inside the collection, not the collection.
Another error you might have is if the collection is null. It is a good idea to check if a collection is null before enumerating.
I think getting any other error is because the logic inside the statement is wrong, not because you are in a foreach loop.