The phone number, represented as a leading plus sign ('+'), followed by a
phone number that uses a relaxed ITU E.164 format consisting of the
country calling code (1 to 3 digits) and the subscriber number, with no
additional spaces or formatting, e.g.:
correct: "+15552220123"
incorrect: "+1 (555) 222-01234 x123".
The ITU E.164 format limits the latter to 12 digits, but in practice not
all countries respect that, so we relax that restriction here.
National-only numbers are not allowed.
The phone number's extension. The extension is not standardized in ITU
recommendations, except for being defined as a series of numbers with a
maximum length of 40 digits. Other than digits, some other dialing
characters such as ',' (indicating a wait) or '#' may be stored here.
Note that no regions currently use extensions with short codes, so this
field is normally only set in conjunction with an E.164 number. It is held
separately from the E.164 number to allow for short code extensions in the
future.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe \u003ccode\u003ePhoneNumber\u003c/code\u003e class represents a phone number for API wire format, but it's not intended for locale-specific formatting, efficient storage, or direct dialing.\u003c/p\u003e\n"],["\u003cp\u003eTo utilize the \u003ccode\u003ePhoneNumber\u003c/code\u003e object effectively, convert it to an \u003ccode\u003ei18n.phonenumbers.PhoneNumber\u003c/code\u003e object for tasks like formatting or use in various use-cases.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePhoneNumber\u003c/code\u003e class supports E.164 formatted numbers (e.g., "+15552220123") and extensions, though extensions are usually paired with E.164 numbers.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePhoneNumber\u003c/code\u003e class also allows for short codes, which is separate from E.164 number, as some regions don't use extensions with short codes.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePhoneNumber\u003c/code\u003e class includes constructors, fields, properties, and methods for managing and manipulating phone number data, such as calculating its size and creating deep clones.\u003c/p\u003e\n"]]],[],null,["# Class PhoneNumber (2.17.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.17.0 (latest)](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.PhoneNumber)\n- [2.15.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.15.0/Google.Type.PhoneNumber)\n- [2.10.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.10.0/Google.Type.PhoneNumber)\n- [2.2.0](/dotnet/docs/reference/Google.Api.CommonProtos/2.2.0/Google.Type.PhoneNumber) \n\n public sealed class PhoneNumber : IMessage\u003cPhoneNumber\u003e, IEquatable\u003cPhoneNumber\u003e, IDeepCloneable\u003cPhoneNumber\u003e, IBufferMessage, IMessage\n\nAn object representing a phone number, suitable as an API wire format.\n\nThis representation:\n\n- should not be used for locale-specific formatting of a phone number, such\n as \"+1 (650) 253-0000 ext. 123\"\n\n- is not designed for efficient storage\n\n- may not be suitable for dialing - specialized libraries (see references) should be used to parse the number for that purpose\n\nTo do something meaningful with this number, such as format it for various\nuse-cases, convert it to an `i18n.phonenumbers.PhoneNumber` object first.\n\nFor instance, in Java this would be:\n\ncom.google.type.PhoneNumber wireProto =\ncom.google.type.PhoneNumber.newBuilder().build();\ncom.google.i18n.phonenumbers.Phonenumber.PhoneNumber phoneNumber =\nPhoneNumberUtil.getInstance().parse(wireProto.getE164Number(), \"ZZ\");\nif (!wireProto.getExtension().isEmpty()) {\nphoneNumber.setExtension(wireProto.getExtension());\n}\n\nReference(s):\n\n- \u003chttps://github.com/google/libphonenumber\u003e \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PhoneNumber \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PhoneNumber](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.PhoneNumber), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PhoneNumber](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.PhoneNumber), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PhoneNumber](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type.PhoneNumber), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals)\n\nNamespace\n---------\n\n[Google.Type](/dotnet/docs/reference/Google.Api.CommonProtos/latest/Google.Type)\n\nAssembly\n--------\n\nGoogle.Api.CommonProtos.dll\n\nConstructors\n------------\n\n### PhoneNumber()\n\n public PhoneNumber()\n\n### PhoneNumber(PhoneNumber)\n\n public PhoneNumber(PhoneNumber other)\n\nFields\n------\n\n### E164NumberFieldNumber\n\n public const int E164NumberFieldNumber = 1\n\nField number for the \"e164_number\" field.\n\n### ExtensionFieldNumber\n\n public const int ExtensionFieldNumber = 3\n\nField number for the \"extension\" field.\n\n### ShortCodeFieldNumber\n\n public const int ShortCodeFieldNumber = 2\n\nField number for the \"short_code\" field.\n\nProperties\n----------\n\n### Descriptor\n\n public static MessageDescriptor Descriptor { get; }\n\n### E164Number\n\n public string E164Number { get; set; }\n\nThe phone number, represented as a leading plus sign ('+'), followed by a\nphone number that uses a relaxed ITU E.164 format consisting of the\ncountry calling code (1 to 3 digits) and the subscriber number, with no\nadditional spaces or formatting, e.g.:\n\n- correct: \"+15552220123\"\n- incorrect: \"+1 (555) 222-01234 x123\".\n\nThe ITU E.164 format limits the latter to 12 digits, but in practice not\nall countries respect that, so we relax that restriction here.\nNational-only numbers are not allowed.\n\nReferences:\n\n- \u003chttps://www.itu.int/rec/T-REC-E.164-201011-I\u003e\n- \u003chttps://en.wikipedia.org/wiki/E.164\u003e.\n- \u003chttps://en.wikipedia.org/wiki/List_of_country_calling_codes\u003e\n\n### Extension\n\n public string Extension { get; set; }\n\nThe phone number's extension. The extension is not standardized in ITU\nrecommendations, except for being defined as a series of numbers with a\nmaximum length of 40 digits. Other than digits, some other dialing\ncharacters such as ',' (indicating a wait) or '#' may be stored here.\n\nNote that no regions currently use extensions with short codes, so this\nfield is normally only set in conjunction with an E.164 number. It is held\nseparately from the E.164 number to allow for short code extensions in the\nfuture.\n\n### HasE164Number\n\n public bool HasE164Number { get; }\n\nGets whether the \"e164_number\" field is set\n\n### KindCase\n\n public PhoneNumber.KindOneofCase KindCase { get; }\n\n### Parser\n\n public static MessageParser\u003cPhoneNumber\u003e Parser { get; }\n\n### ShortCode\n\n public PhoneNumber.Types.ShortCode ShortCode { get; set; }\n\nA short code.\n\nReference(s):\n\n- \u003chttps://en.wikipedia.org/wiki/Short_code\u003e\n\nMethods\n-------\n\n### CalculateSize()\n\n public int CalculateSize()\n\n### ClearE164Number()\n\n public void ClearE164Number()\n\nClears the value of the oneof if it's currently set to \"e164_number\"\n\n### ClearKind()\n\n public void ClearKind()\n\n### Clone()\n\n public PhoneNumber Clone()\n\n### Equals(PhoneNumber)\n\n public bool Equals(PhoneNumber other)\n\n### Equals(object)\n\n public override bool Equals(object other)\n\n**Overrides** \n[object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object))\n\n### GetHashCode()\n\n public override int GetHashCode()\n\n**Overrides** \n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode)\n\n### MergeFrom(CodedInputStream)\n\n public void MergeFrom(CodedInputStream input)\n\n### MergeFrom(PhoneNumber)\n\n public void MergeFrom(PhoneNumber other)\n\n### ToString()\n\n public override string ToString()\n\n**Overrides** \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\n### WriteTo(CodedOutputStream)\n\n public void WriteTo(CodedOutputStream output)"]]