You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm new to ValueOf so this may be a basic question, but it there a way of creating an object with alternative data formats? For example I would like to represent a telephone number as a long, but I also want to be able to create the object using a string.
So I would like to accept:
1234567890 (long)
But I would also like to create the object using
(123)456-7890 (string)
or 123-456-7890 (string)
or +1 123-45-6789 (string).
In all cases, the actual data would be represented as a long.
I realize that I'm supposed to create the object using TelephoneNumber.From(1234567890)
but can I have the alternate constructors?
Thank you
The text was updated successfully, but these errors were encountered:
public class TelephoneNumber : ValueOf<long, TelephoneNumber>
{
public static TelephoneNumber From(string value) => TelephoneNumber.From(long.Parse(value));
}
Hello,
I'm new to ValueOf so this may be a basic question, but it there a way of creating an object with alternative data formats? For example I would like to represent a telephone number as a long, but I also want to be able to create the object using a string.
So I would like to accept:
1234567890 (long)
But I would also like to create the object using
(123)456-7890 (string)
or 123-456-7890 (string)
or +1 123-45-6789 (string).
In all cases, the actual data would be represented as a long.
I realize that I'm supposed to create the object using TelephoneNumber.From(1234567890)
but can I have the alternate constructors?
Thank you
The text was updated successfully, but these errors were encountered: