本文整理汇总了C#中PhoneNumbers.PhoneNumber.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# PhoneNumber.Clone方法的具体用法?C# PhoneNumber.Clone怎么用?C# PhoneNumber.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhoneNumbers.PhoneNumber
的用法示例。
在下文中一共展示了PhoneNumber.Clone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AreEqual
private static bool AreEqual(PhoneNumber.Builder p1, PhoneNumber.Builder p2)
{
return p1.Clone().Build().Equals(p2.Clone().Build());
}
示例2: TruncateTooLongNumber
/**
* Attempts to extract a valid number from a phone number that is too long to be valid, and resets
* the PhoneNumber object passed in to that valid version. If no valid number could be extracted,
* the PhoneNumber object passed in will not be modified.
* @param number a PhoneNumber object which contains a number that is too long to be valid.
* @return true if a valid phone number can be successfully extracted.
*/
public bool TruncateTooLongNumber(PhoneNumber.Builder number)
{
if (IsValidNumber(number.Clone().Build()))
return true;
PhoneNumber copy = null;
ulong nationalNumber = number.NationalNumber;
do
{
nationalNumber /= 10;
PhoneNumber.Builder numberCopy = number.Clone();
numberCopy.SetNationalNumber(nationalNumber);
copy = numberCopy.Build();
if (IsPossibleNumberWithReason(copy) == ValidationResult.TOO_SHORT ||
nationalNumber == 0)
return false;
}
while (!IsValidNumber(copy));
number.SetNationalNumber(nationalNumber);
return true;
}