-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAddress.cs
57 lines (45 loc) · 1.37 KB
/
Address.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System;
namespace RaGae.ModelLib
{
public class Address : ICloneable
{
private string street;
private string number;
public Address() { }
public Address(string street, string number)
{
this.Street = street;
this.Number = number;
}
public string Street
{
get => this.street;
set
{
if (string.IsNullOrWhiteSpace(value))
throw new Exception($"{nameof(Address)}:{nameof(Street)}");
this.street = value;
}
}
public string Number
{
get => this.number;
set
{
if (string.IsNullOrWhiteSpace(value))
throw new Exception($"{nameof(Address)}:{nameof(Number)}");
this.number = value;
}
}
public City City { get; set; }
public Country Country { get; set; }
public object Clone()
{
Address address = (Address)this.MemberwiseClone();
address.City = (City)this.City.Clone();
address.Country = (Country)this.Country.Clone();
return address;
}
public override string ToString() => $"{this.Street} {this.Number}";
}
}