CSharp examples for System.Collections.Generic:List
Move element To First in List
using System.Linq; using System.Text; using System.Globalization; using System.ComponentModel; using System.Collections.Generic; using System.Collections; public class Main{ public static List<TSource> MoveToFirst<TSource>(this List<TSource> source, TSource element) {/*from www .ja v a2s .co m*/ if (!source.Contains(element)) return source; source.Remove(element); source.Insert(0, element); return source; } public static bool Contains<T>(this IEnumerable<T> me, Predicate<T> condition) { foreach (var val in me) { if (condition(val)) return true; } return false; } }