var items = new List<Product>(Enumerable.Range(0, 10).Select(i => new Product { title = GoToPrice().title, price = GoToPrice().price }));
public static (string title, int price) GoToPrice()
{
using (var client = new WebClient())
using (var stream = client.OpenRead(data_url))
using (var reader = new StreamReader(stream))
{
var jObject = JObject.Parse(reader.ReadLine());
var feed = JsonConvert.DeserializeObject<Categories>(jObject.ToString());
foreach (var item in feed.Products)
{
var result = (title: item.title, price: item.price);
return (result.title, result.price);
}
return ("Ошибка", 0);
}
}