I have the following code for selecting an option from given list and it usually works, but sometimes it fails with NoSuchElement exception on the second if. I was under the
well, I am Java guy, so I will not provide you the code, but rather the algorithm:
So, basically you should do some exception handling in the for loop and catch this exception and do nothing. In Java its done by try
and catch
block. But because I dont know C# you will have to find out how its done in this language