Exemple #1
0
 public static Address Parse(string address)
 {
     var rx = new Regex("Street : (.*), City : (.*), PostCode : (.*)");
     var match = rx.Match(address);
     var street = new Street(match.Groups[0].Value);
     var city = new City(match.Groups[1].Value);
     var postcode = new PostCode(match.Groups[2].Value);
     return new Address(street, city, postcode);
 }
Exemple #2
0
        public static Address Parse(string address)
        {
            var rx    = new Regex("BuildingNumber: (.*), StreetName: (.*), City: (.*), PostCode: (.*)");
            var match = rx.Match(address);

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

            if (!int.TryParse(streetNumber, out number))
            {
                number = 0;
            }
            var 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));
        }
Exemple #3
0
 public Address()
 {
     city       = new City();
     postalCode = new PostCode();
     street     = new Street();
 }
Exemple #4
0
 public Address(Street street, City city, PostCode postalCode)
 {
     this.street     = street;
     this.postalCode = postalCode;
     this.city       = city;
 }
Exemple #5
0
 public Address(Street street, City city, PostCode postalCode)
 {
     this.street = street;
     this.postalCode = postalCode;
     this.city = city;
 }