public static void Main()
var theThingTrue = new BuilderFoo().BuildFooTrue()
.WithSomePropertyOnlyForTrue("face").Build();
var theThingFalse = new BuilderFoo().BuildFooFalse()
Console.WriteLine("hello");
public interface ISettings
string SomePropertyOnlyForTrue { get; }
public class Settings : ISettings
public string SomePropertyOnlyForTrue { get; }
public Settings(string somePropertyOnlyForTrue)
SomePropertyOnlyForTrue = somePropertyOnlyForTrue;
public interface IBuilderFoo
IBuilderFooTrue BuildFooTrue();
IBuilderFooFalse BuildFooFalse();
public class BuilderFoo : IBuilderFoo
public IBuilderFooTrue BuildFooTrue()
return new BuilderFooTrue();
public IBuilderFooFalse BuildFooFalse()
return new BuilderFooFalse();
public interface IBuilderFooTrue
IBuilderFooTrue WithSomePropertyOnlyForTrue(string value);
public class BuilderFooTrue : IBuilderFooTrue
private string _somePropertyOnlyForTrue = string.Empty;
public IBuilderFooTrue WithSomePropertyOnlyForTrue(string value)
_somePropertyOnlyForTrue = value;
return new Settings(_somePropertyOnlyForTrue);
public interface IBuilderFooFalse
IBuilderFooFalse WithB(int value);
public class BuilderFooFalse : IBuilderFooFalse
public IBuilderFooFalse WithB(int value)