I’m writing an extension method called ToPhoneFormat that formats a string of digits to phone numbers.
Is it possible to add a parameter to the method that would enable me to call it like this: MyPhoneString.ToPhoneFormat(international code)
That way, I could write MyPhoneString.ToPhoneFormat(1); to format a US phone number and MyPhoneString.ToPhoneFormat(33) to format a French phone number.
I already wrote the method that does the formatting but I’m wondering how to build the constructor so that it works with a parameter when I’m calling it.
Thanks.
nice and easy 🙂
I’m assuming your method signature for ToPhoneFormat looks something like:
if so, the all you need to do is add a parameter after the
thisparameter, so it becomes: