public static void Start()
        {
            var pb = new PersonBuilder();
            Person person = pb
              .Lives
                .At("123 London Road")
                .In("London")
                .WithPostcode("SW12BC")
              .Works
                .At("Fabrikam")
                .AsA("Engineer")
                .Earning(123000);

            Console.WriteLine(person);
        }
 public static PersonBuilder WorksAsA
     (this PersonBuilder builder, string position)
 {
     builder.Do(p => p.Position = position);
     return(builder);
 }
 public static PersonBuilder WorksAsA
     (this PersonBuilder builder, string position)
 {
     builder.Actions.Add(p => { p.Position = position; });
     return(builder);
 }
 public static void Main(string[] args)
 {
     var pb     = new PersonBuilder();
     var person = pb.Called("Dmitri").WorksAsA("Programmer").Build();
 }
Пример #5
0
 public static PersonBuilder WorksAs(this PersonBuilder builder, string position)
 => builder.Do(x => x.Position = position);