public class Customer DataType DataType EmailAddress public string Ema

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
public class Customer
{
[DataType(DataType.EmailAddress)]
public string EmailAddress { get; set; }
[DataType(DataType.PhoneNumber)]
privat string Phone { get; set; }
}
...
var a = new Customer();
var email = a.EmailAddress;
var phone = a.Phone;
...