Skip to content

Commit a12e2df

Browse files
codejudasDoug Black
authored andcommitted
Add implicit operator constructor to PhoneNumber type
1 parent 3508b90 commit a12e2df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Twilio/Types/PhoneNumber.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ public PhoneNumber(string number)
1616
_number = number;
1717
}
1818

19+
/// <summary>
20+
/// Add implicit constructor for PhoneNumber to make it assignable from string
21+
/// </summary>
22+
/// <param name="number">Phone number</param>
23+
/// <returns></returns>
24+
public static implicit operator PhoneNumber(string number)
25+
{
26+
return new PhoneNumber(number);
27+
}
28+
1929
/// <summary>
2030
/// Convert to string
2131
/// </summary>

0 commit comments

Comments
 (0)