יום שלישי, 20 באוקטובר 2009
יום שבת, 24 בינואר 2009
extension method
one line shuffling IEnumarable
actually two
public static IEnumerableShuffle (this IEnumerable source)
{
Random rand=new Random(DateTime.Now.Ticks);
return source.Select(t => new Pair(rand.Next(), t)).OrderBy(pair => (int)pair.First)
.Select(pair => (T)pair.Second).ToList();
{
הירשם ל-
רשומות (Atom)