2
votes

I am developing a Windows Phone 8 app with in-app purchase capability. In order to retrieve my products I do this:

ListingInformation listing = await CurrentApp.LoadListingInformationAsync();
foreach (var productListing in listing.ProductListings.Values)
{
    ...
}

where listing.ProductListings's type is as shown below enter image description here


However, when I try to replace var with ProductListing, I get the following error enter image description here So I am unable to access my product information.

This is the product listing class:

public class ProductListing
{
    public string Description { get; set; }
    public string FormattedPrice { get; set; }
    public Uri ImageUri { get; set; }
    public IEnumerable<string> Keywords { get; set; }
    public string Name { get; set; }
    public string ProductId { get; set; }
    public ProductType ProductType { get; set; }
    public string Tag { get; set; }
}
1
Can you post more code about that ProductListing type?Shmwel
Are you really using the Windows.ApplicationModel.Store.ProductListing class or did you create a class named ProductListing?heringer
@heringer I am using the actual one. I got this code from a sample mock library provided by Microsoftuser123
any chance to use the "var" declaration and print productListing.GetType().ToString() ?heringer
@heringer I created a test project and yes the type is indeed ProductListing and contains all the right information. However when I try to cast it in code to a ProductListing type, the compiler issues the error 'Cannot cast expression of type 'TValue' to type 'ProductListing'.user123

1 Answers

0
votes

Turns out this is a bug with Resharper 8.2. The new RC update seems to fix it.