WalletAddress.FromCivicAddress Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Creates an Address instance from a CivicAddress.
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
'Declaration Public Shared Function FromCivicAddress ( _ civicAddress As CivicAddress _ ) As WalletAddress
Parameters
- civicAddress
- Type: System.Device.Location.CivicAddress
The CivicAddress to convert.
This method currently throws a NullReferenceException. To overcome this issue, you can write an extension method to convert a CivicAddress to a WalletAddress as follows:
public static class MyWalletExtension { public static void AssignCivicAddress(this WalletAddress walletAddress, System.Device.Location.CivicAddress civicAddress) { walletAddress.City = civicAddress.City; walletAddress.CountryRegion = civicAddress.CountryRegion; walletAddress.PostalCode = civicAddress.PostalCode; walletAddress.StateProvince = civicAddress.StateProvince; walletAddress.Street = civicAddress.AddressLine1; } }
You can then use this extension method as follows to convert a CivicAddress to a WalletAddress.
private void SampleFromCivicAddress(System.Device.Location.CivicAddress civicAddress) { Deal deal = new Deal(); deal.MerchantAddress.Business1.AssignCivicAddress(civicAddress); }
Show: