-
Notifications
You must be signed in to change notification settings - Fork 5
/
Inheritance.cs
43 lines (31 loc) · 911 Bytes
/
Inheritance.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
// This is public domain Metalama sample code.
using Metalama.Patterns.Contracts;
namespace Doc.Contracts.Inheritance
{
public interface ICustomer
{
[Phone]
string? Phone { get; set; }
[Url]
string? Url { get; set; }
[Range( 1900, 2100 )]
int? BirthYear { get; set; }
[Required]
string FirstName { get; set; }
[Required]
string LastName { get; set; }
}
public class Customer : ICustomer
{
public string? Phone { get; set; }
public string? Url { get; set; }
public int? BirthYear { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public Customer( [Required] string firstName, [Required] string lastName )
{
this.FirstName = firstName;
this.LastName = lastName;
}
}
}