예제 #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);
 }
예제 #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));
        }
예제 #3
0
 public Address()
 {
     city       = new City();
     postalCode = new PostCode();
     street     = new Street();
 }
예제 #4
0
 public Address(Street street, City city, PostCode postalCode)
 {
     this.street     = street;
     this.postalCode = postalCode;
     this.city       = city;
 }
예제 #5
0
 public Address(Street street, City city, PostCode postalCode)
 {
     this.street = street;
     this.postalCode = postalCode;
     this.city = city;
 }