Cannot implicitly convert type 'int' to 'System.Collections.Generic.IEnumerable
public static IEnumerable<int> GetOdd()
{
// Use yield to return only the odd numbers.
foreach (int i in ints)
if (i % 2 == 1)
return i;
}
Check if you are missing any yield statement in the return
public static IEnumerable<int> GetOdd()
{
// Use yield to return only the odd numbers.
foreach (int i in ints)
if (i % 2 == 1)
yield return i;
}
No comments:
Post a Comment