FromCivicAddress Method
Collapse the table of content
Expand the table of content

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.

Namespace:  Microsoft.Phone.Wallet
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.

Return Value

Type: Microsoft.Phone.Wallet.WalletAddress
An Address instance from a CivicAddress.

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);
}



Windows Phone OS

Supported in: 8.1, 8.0

Show:
© 2017 Microsoft