-
-
Save vkhorikov/dcbf961842d72bc0d3db60abb5f0a901 to your computer and use it in GitHub Desktop.
Using Value Objects to represent technical concerns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
public string Name { get; set; } | |
public string Email { get; set; } | |
} | |
Customer customer = GetCustomer(); | |
customer.Name = customer.Email; // Compiles perfectly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
public Optional70LimitedString Name { get; set; } | |
public Optional70LimitedString Email { get; set; } | |
} | |
Customer customer = GetCustomer(); | |
customer.Name = customer.Email; // Compiles perfectly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Customer | |
{ | |
public CustomerName Name { get; set; } | |
public Email Email { get; set; } | |
} | |
Customer customer = GetCustomer(); | |
customer.Name = customer.Email; // Doesn't compile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment