Exemplo n.º 1
0
 static void Main(string[] args)
 {
     var person = new PersonBuilder()
                     .WithFirstName("chansak")
                     .WithLastName("kochasen")
                     .Build();
     Console.WriteLine(person.FirstName);
     Console.WriteLine(person.LastName);
     Console.ReadKey();
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var    pb     = new PersonBuilder();
            Person person = pb
                            .Lives
                            .At("123 London Road")
                            .In("London")
                            .WithPostcode("SW12BC")
                            .Works
                            .At("Fabrikam")
                            .AsA("Engineer")
                            .Earning(123000);

            WriteLine(person);
        }
        public static void TestBuilder()
        {
            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);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Person Person = new PersonBuilder("Ahmad")
                            .AddLastName("Aly")
                            .AddMiddleName("Sabry")
                            .AddAge(15)
                            .AddGender("Male")
                            .GetPerson();

            System.Console.WriteLine(Person.FirstName);
            System.Console.WriteLine(Person.MiddleName);
            System.Console.WriteLine(Person.LastName);
            System.Console.WriteLine(Person.Age);
            System.Console.WriteLine(Person.Gender);
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            //call non fluent builer
            HtmlBuilder builder = new HtmlBuilder("ul");

            builder.AddChild("li", "one");
            builder.AddChild("li", "two");
            builder.AddChild("li", "three");
            Console.WriteLine(builder.ToString());
            //call fluent buiilder pattern
            Employee emp = Employee.New.SetName("AMOSE").WorkingAs("Architect").Build();

            //faceted builder
            PersonBuilder v      = new PersonBuilder();
            Person        person = v
                                   .lives.LivesAt("tuty")
                                   .AreaCode("628008")
                                   .works.AsA("software enginier").
                                   At("lynk").
                                   Earning(0000);
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Person person1 = new Person();

            person1.firstName = "Haba";
            person1.lastName  = "Baba";

            Phone phone1 = new Phone();

            phone1.number = "601234012";
            phone1.area   = "032";

            Template template1 = new Template();

            PersonBuilder builder = new PersonBuilder();

            builder.template = template1;
            builder.person   = person1;
            builder.phone    = phone1;

            builder.build();

            Console.ReadKey();
        }
Exemplo n.º 7
0
 public PersonDirector(PersonBuilder pb)
 {
     this.pb = pb;
 }
Exemplo n.º 8
0
 public PersonDirector(PersonBuilder pb)
 {
     _pb = pb;
 }