MicroElements source only package: Collection extensions: NotNull, Iterate, Execute, WhereNotNull, Materialize, IncludeByWildcardPatterns, ExcludeByWildcardPatterns. Special collections: Cache, TwoLayerCache, PollingCache.
$ dotnet add package MicroElements.Collections.SourcesMicroElements source only package: Collection extensions.
Source only package does not forces binary reference on it. Just add package and use as code.
Returns not null (empty) enumeration if input is null.
string? GetFirstName(IEnumerable<string>? names)
{
return names
.NotNull()
.FirstOrDefault();
}
Iterates values and executes action for each value.
It's like List.ForEach but works with lazy enumerations and does not forces additional allocations.
// Iterates values and outputs to console.
Enumerable
.Range(1, 100_000)
.Iterate(Console.WriteLine);
Represents ThreadSafe cache that holds only limited number of items. Can be used as drop in replacement for ConcurrentDictionary.
Use it when you need simple cache but with memory limit.
Notes: