You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
namespace gaemstone.Utility;
|
|
|
|
|
|
|
|
public static class CollectionExtensions
|
|
|
|
{
|
|
|
|
// public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dict,
|
|
|
|
// TKey key, Func<TKey, TValue> valueFactory) { }
|
|
|
|
|
|
|
|
public static T? FirstOrNull<T>(this IEnumerable<T> enumerable)
|
|
|
|
where T : struct
|
|
|
|
{
|
|
|
|
using var enumerator = enumerable.GetEnumerator();
|
|
|
|
return enumerator.MoveNext() ? enumerator.Current : null;
|
|
|
|
}
|
|
|
|
}
|