I've been learning the object initializer in C# recently, but now I'm wondering how it works when it conflicts with the constructor.
public class A
{
    public bool foo { get; set; }
    public A()
    {
        foo = true;
    }
    public A(bool bar)
    {
        foo = bar;
    }
}
What happens when I try this?
public class B
{
    private A a = new A() { foo = false };
    private A b = new A(true) { foo = false };
}
Is a default in the constructor a good way to have a bool that starts true and can be changed?
public A(bool bar = true)
{
    foo = bar;
}
 
     
     
    
 
     
     
     
    