Commit 9adab126 authored by Uladzimir Makarevich's avatar Uladzimir Makarevich

MAKE !

parent 4da02bbf
......@@ -7,6 +7,18 @@ namespace System.Linq
{
public static class EnumerableExtensions
{
public static T Head<T>(this IEnumerable<T> collection) => collection.First();
public static T Tail<T>(this IEnumerable<T> collection) => collection.Last();
public static T HeadOrDefault<T>(this IEnumerable<T> collection) => collection.FirstOrDefault();
public static T TailOrDefault<T>(this IEnumerable<T> collection) => collection.LastOrDefault();
public static T Set<T>(this IList<T> collection, int index, T value) =>
collection[index < 0 ? collection.Count + index : index] = value;
public static T Get<T>(this IList<T> collection, int index) =>
collection[index < 0 ? collection.Count + index : index];
public static int[] IndexesOf<T>(this IEnumerable<T> collection, T value)
{
var indexes = new List<int>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment