- Value property to return the primitive value
- Overrided
ToString
for easy logging - Implicit conversion, so that the type can be used as if it's a primitive type
public class StringValue
{
public string Value { get; }
public StringValue(string value)
{
Value = value;
}
public override string ToString()
{
return Value;
}
public static implicit operator string(StringValue valueType) => valueType.Value;
}
public class Email : StringValue
{
public Email(string value) : base(value) { }
}