本文整理汇总了C#中Validator.GetPhoneNumberAsObject方法的典型用法代码示例。如果您正苦于以下问题:C# Validator.GetPhoneNumberAsObject方法的具体用法?C# Validator.GetPhoneNumberAsObject怎么用?C# Validator.GetPhoneNumberAsObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator.GetPhoneNumberAsObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFromStandardPhoneString
// These members deal with formatted phone number strings
/// <summary>
/// Creates a phone number object from a standard phone number string, presumably from a database or similar source.
/// </summary>
public static PhoneNumber CreateFromStandardPhoneString( string phoneString )
{
var v = new Validator();
// NOTE: I don't like how this method is called, which calls a method in validator, which then calls one of the static constructors back here (but not this one! otherwise you are screwed)
var p = v.GetPhoneNumberAsObject( new ValidationErrorHandler( "" ), phoneString, true, true, false, null );
// pass "" for the error message subject because we should never get errors
if( v.ErrorsOccurred )
throw new ApplicationException( "Unparsable standard phone number string encountered." );
return p;
}