This compiles fine:
using Microsoft.Extensions.Configuration;
internal class Program
{
private static void Main() { }
private static C Foo(IConfiguration configuration)
{
C c = new();
configuration.Bind(c);
return c;
}
internal sealed class C
{
public int Value { get; set; }
}
}
but changing:
to
produces an error about C being inaccessible, as the generator emits code into another class that tries to access that property.