lundi 28 mars 2016

How can I get a random number of element from list

I am writing to You with small problem. I am writing small application in C#.NET MVC5, and I have one question, how can I get a few random items from List?

My code:

public ActionResult ProductsList()
{
    List<Product> products = productRepo.GetProduct().ToList();
    return PartialView(products);
}

This method return full list, how can I do it correctly?




Aucun commentaire:

Enregistrer un commentaire