using System.Collections.Generic; namespace Extra_Function { public static class Function { public static T Pop<T>(this List<T> list) { if (list != null && list.Count > 0) { T value = list[list.Count - 1]; list.RemoveAt(list.Count - 1); return value; } else { return default(T); } } public static T Peek<T>(this List<T> list) { if (list != null && list.Count > 0) { return list[list.Count - 1]; } else { return default(T); } } public static void Push<T>(this List<T> list, T value) { list.Add(value); } } }