Consider the following code:
public record Foo
{
public required string A { get; init; }
public required string B { get; init; }
}
public record Bar : Foo
{
public Bar()
{
A = "TEST";
}
}
var bar = new Bar
{
B = "ANOTHER TEST"
}
In this situation the compiler will say that field A
is not set, while it is clearly set it just does not know about it. Is there any workaround for this?