i\'m using Asp.net MVC with Sharp Architecture.
I have this code:
return _repositoryKeyWord.FindAll(x => x.Category.Id == idCAtegory)
Probably best to write your own extension method to do it.
public static class Extensions
{
static readonly Random random = new Random();
public static IEnumerable Shuffle(this IEnumerable items)
{
return Shuffle(items, random);
}
public static IEnumerable Shuffle(this IEnumerable items, Random random)
{
// Un-optimized algorithm taken from
// http://en.wikipedia.org/wiki/Knuth_shuffle#The_modern_algorithm
List list = new List(items);
for (int i = list.Count - 1; i >= 1; i--)
{
int j = random.Next(0, i);
T temp = list[i];
list[i] = list[j];
list[j] = temp;
}
return list;
}
}