using System.Collections.Generic;
class C
{
IEnumerable<int> M1()
{
yield return foo; // correctly generates int
}
void M2()
{
IEnumerable<int> F()
{
yield return foo; // generates object
}
}
}
If I choose to generate a field in M1, its type will be int. If I do the same inside the local function, the type of the field will be object, which is wrong.
If I choose to generate a field in M1, its type will be
int. If I do the same inside the local function, the type of the field will beobject, which is wrong.