UnityEssentials
Small but useful tools and features for Unity
ICollectionExtensions.cs
Go to the documentation of this file.
1 using System.Collections.Generic;
2 using System.Linq;
3 
4 namespace UnityEngine
5 {
9  public static class ICollectionExtensions
10  {
15  public static T RemoveFirst<T>(this ICollection<T> collection)
16  {
17  T element = collection.FirstOrDefault();
18  if (element != null)
19  collection.Remove(element);
20  return element;
21  }
22  }
23 }
static T RemoveFirst< T >(this ICollection< T > collection)
Removes the first element of the collection.