The method returns IEnumerable via a yield return statement.
If the yield statement never occurs (it’s inside conditional logic), will the method return null, or will it return an Enumerable with a count of 0?
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.
A valid IEnumerable that produces no values when you iterate through it.
Just think of it: You can store the IEnumerable generator in a variable – the code itself just gets executed when you actually iterate through the results. How could you execute the code if you had
null? Or how did you know the function doesn’t yield anything without running it.