If so, on what .NET Framework versions is it supported?
I have tested this on .NET Framework 4.0 and it works fine:
using System;
using System.Collections.Generic;
public class TestClass
{
public IEnumerable Defer()
{
yield return 1;
yield return 2;
yield return 3;
}
}
Yes, it is supported ever since the yield
keyword was. The only difference is that it's more or less IEnumerable<object>
, which might lead to inefficiencies if it has to do boxing. Other than that, it's exactly the same.