Windows Phone Developers

Sunday, February 22, 2009

Cannot implicitly convert type 'int' to 'System.Collections.Generic.IEnumerable

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;

}


Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment