You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the fastest way to get total pages count or total product count? Only the number not the products themselves.
I'm trying to optimize this piece of code to make it somehow concurrent with multiple tasks retrieving products at the same time:
private async Task<List<Product>> ListProducts()
{
Console.WriteLine("Leyendo PRODUCTOS desde la pagina.");
List<Product> ProductsPage = new List<Product>();
Dictionary<string, string> dic1 = new Dictionary<string, string>
{
{ "per_page", "100" }
};
int pageNumber1 = 1;
dic1.Add("page", pageNumber1.ToString());
var ProductsPageTemp = await wc.Product.GetAll(dic1);
while (ProductsPageTemp.Count > 0)
{
ProductsPage.AddRange(ProductsPageTemp);
pageNumber1++;
dic1["page"] = pageNumber1.ToString();
ProductsPageTemp = await wc.Product.GetAll(dic1);
}
Console.WriteLine(" ¡Exito Leyendo PRODUCTOS desde la pagina!");
return ProductsPage;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What is the fastest way to get total pages count or total product count? Only the number not the products themselves.
I'm trying to optimize this piece of code to make it somehow concurrent with multiple tasks retrieving products at the same time:
Beta Was this translation helpful? Give feedback.
All reactions