# Phone validation

`PhoneNumberValidationAsync()` checks whether a phone number is valid and returns it in national and international format, with its country and network.

Phone.cscsharp

```csharp
using IdealPostcodes;

using var client = new IdealPostcodesClient("ak_test");

var result = (await client.PhoneNumberValidationAsync(new PhoneNumberValidationParams("+44 20 7112 8019"))).Result;

if (result is PhoneNumber phone)
{
    Console.WriteLine($"{phone.InternationalFormat} {phone.Country} {phone.OriginalCarrier?.Name}");
}
```

Include the country code. A UK number can start `+44`, `44` or `0044`. Your key needs phone validation enabled.

## Result

A valid number returns a `PhoneNumber` with:

| Property                       | Example                                                                                                                    |
| ------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `NationalFormat`               | `020 7112 8019`                                                                                                            |
| `InternationalFormat`          | `+44 20 7112 8019`                                                                                                         |
| `IsoCountry` and `IsoCountry2` | `GBR` and `GB`                                                                                                             |
| `Country`                      | `United Kingdom`                                                                                                           |
| `OriginalCarrier`              | A `Carrier` for the network the number was first assigned to, with `Name` and `NetworkType` such as `mobile` or `landline` |

An invalid number returns an `InvalidPhoneNumber` with `Valid` `false` and every other property null. It is not an error, so check the class before reading the formats. `Valid` is on `IPhoneNumberResponseResult`.

## Current network

Set `CurrentCarrier = "true"` on the parameters to fill `CurrentCarrier` on the result as well. A number can move to another network, so `OriginalCarrier` alone can be out of date. The extra check can be slow, depending on the network, so allow for it in your [request timeout](/docs/sdks/dotnet/setup.md#request-timeout-and-cancellation).

Carrier.cscsharp

```csharp
var result = (await client.PhoneNumberValidationAsync(new PhoneNumberValidationParams("+44 20 7112 8019") { CurrentCarrier = "true" })).Result;
```

## Cost

One lookup per request, including numbers that are invalid or fail to parse.

See [`PhoneNumberValidationAsync()`](/docs/sdks/dotnet/endpoints/phone-number-validation.md) for the parameters and the [phone validation guide](/docs/guides/phone-validation.md) for how the checks work.
