Ejemplo n.º 1
0
        public static void Main()
        {
            IAddressBuilder addressBuilder = new AddressBuilder();
            IUserBuilder    userBuilder    = new UserBuilder(addressBuilder);

            var user = userBuilder
                       .WithName("Name")
                       .WithSurname("Surname")
                       .WithEmail("*****@*****.**")
                       .WithCity("City")
                       .WithState("State")
                       .WithCountry("Country")
                       .Build();

            Console.WriteLine($"Name: {user.Name}");
            Console.WriteLine($"Surname: {user.Surname}");
            Console.WriteLine($"Email: {user.Email}");
            Console.WriteLine($"City: {user.Address.City}");
            Console.WriteLine($"State: {user.Address.State}");
            Console.WriteLine($"Country: {user.Address.Country}");

            Console.ReadKey();
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     User Tom   = new UserBuilder().SetName("tom").SetAge(23).SetCompany("Microsoft").Build();
     User alice = User.CreateBuilder().SetName("Alice").SetAge(25).IsMaried;
 }