I want to get the following custom data of my shop items but I get an error message when I want to get the values:
Error CS1061: 'KeyValuePair<string, object>' does not contain a definition for 'TryGetValue' and no accessible extension method 'TryGetValue' accepting a first argument of type 'KeyValuePair<string, object>' could be found (are you missing a using directive or an assembly reference?)
List<string> customdatakeys = new List<string>(); List<string> customdatavalueswood = new List<string>(); List<string> customdatavaluesiron = new List<string>(); List<string> customdatavaluesdiamond = new List<string>(); var result = await PlayFabClientAPI.GetCatalogItemsAsync(new PlayFab.ClientModels.GetCatalogItemsRequest() { CatalogVersion = "MyShop" }); if (result.Error != null) { } else { foreach (var entry in result.Result.Catalog) { if (entry.CustomData != null) { var customdata = PlayFab.PluginManager.GetPlugin<ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject<Dictionary<string, object>>(entry.CustomData); foreach (var customentry in customdata) { customdatakeys.Add(customentry.Key); if (customentry.TryGetValue("Wood", out object x)) { customdatavalueswood.Add(Convert.ToString(x)); } else customdatavalueswood.Add("0"); if (customentry.TryGetValue("Iron", out object y)) { customdatavaluesiron.Add(Convert.ToString(y)); } else customdatavaluesiron.Add("0"); if (customentry.TryGetValue("Diamond", out object z)) { customdatavaluesdiamond.Add(Convert.ToString(z)); } else customdatavaluesdiamond.Add("0"); } } } } }
How can I get the custom data from my shop items in the client?