using System; using System.Collections.Generic; public class Test { public static void Main() { var stringList = new List { "1", "2" }; stringList.Shuffle(); foreach (var l in stringList) Console.WriteLine(l); var intList = new List { 1, 2 }; intList.Shuffle(); foreach (var l in intList) Console.WriteLine(l); } } public static class ListExtensions { public static void Shuffle(this List list) { Console.WriteLine(typeof(T)); var t = list[0]; list[0] = list[1]; list[1] = t; } }