2018-02-17 21:19:50 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-09-02 20:52:22 +00:00
|
|
|
|
using System.Linq;
|
2018-02-17 21:19:50 +00:00
|
|
|
|
|
|
|
|
|
namespace MarkovGrams.Utilities
|
|
|
|
|
{
|
|
|
|
|
public static class LinqExtensions
|
|
|
|
|
{
|
|
|
|
|
public static void ForEach<T>(this IEnumerable<T> enumerable, Action<T> action)
|
|
|
|
|
{
|
|
|
|
|
foreach (T item in enumerable)
|
|
|
|
|
{
|
|
|
|
|
action(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-09-02 20:52:22 +00:00
|
|
|
|
|
|
|
|
|
public static T ShiftAt<T>(this List<T> list, int index)
|
|
|
|
|
{
|
|
|
|
|
T item = list[index];
|
|
|
|
|
list.RemoveAt(index);
|
|
|
|
|
return item;
|
|
|
|
|
}
|
2018-02-17 21:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|