Ejemplo n.º 1
0
        public static Address Parse(string address)
        {
            var   rx    = new Regex("BuildingNumber: (.*), StreetName: (.*), City: (.*), PostCode: (.*)");
            Match match = rx.Match(address);

            string streetNumber = match.Groups[1].Value;
            int    number;

            if (!int.TryParse(streetNumber, out number))
            {
                number = 0;
            }
            string streetName = match.Groups[2].Value;
            var    street     = new Street(number, streetName);

            var city     = new City(match.Groups[3].Value);
            var postcode = new PostCode(match.Groups[4].Value);

            return(new Address(street, city, postcode));
        }
Ejemplo n.º 2
0
 public Address()
 {
     city       = new City();
     postalCode = new PostCode();
     street     = new Street();
 }
Ejemplo n.º 3
0
 public Address(Street street, City city, PostCode postalCode)
 {
     this.street     = street;
     this.postalCode = postalCode;
     this.city       = city;
 }