Lombiq Helpful Libraries - Common Libraries - Extensions
February 24, 2024 ยท View on GitHub
ArrayExtensions: Adds useful extensions to arrays. For example,Exists()is a fluid alternative toArray.Exists().CollectionExtensions: AddsICollection<T>extensions. For example,CartesianProduct()for producing all pairs of two collections, orRemoveAll()to filter an existing collection in-place.ConfigurationExtensions: Shortcuts forIConfigurationoperations.DictionaryExtensions: AddsIDictionary<TKey, TValue>extensions. For example,GetMaybe()for safely retrieving an item if it's in the dictionary or returningdefaultwithout throwing an exception.EnumerableExtensions: AddsIEnumerable<T>extensions. For example,AwaitEachAsync()for performing async operations on a collection sequentially, orAsList()for casting toList<T>without necessarily creating a new list.EnumExtensions: Adds extensions for working withenumtypes. For example,UnknownEnumExceptionwhich can be used to raise a standardized exception on the default arm of aswitch.ExceptionExtensions: AnIsFatal()method to check if the exception is one that the application can't recover from.ExpressionExtensions: AddsSystem.Linq.Expressions. For example,StripResult()turns aFunc<T1, T2>expression into anAction<T1>one.HttpContextExtensions: Some shortcuts for managing cookies.IoExtensions: Adds extensions forString.IOtypes. For example,TextWriter.WriteLineInvariant()writes interpolated string in a culture invariant manner.JsonExtensions: Adds extensions forSystem.Text.Json.Nodestypes. For example,JsonObject.TryParse<T>(out var result)attempts to convert the JSON object into a C# object.MemoryCacheExtensions: Adds extensions forIMemoryCachemanipulation. For example,GetOrNew<T>()type-safely returns the item or creates a new instance.MulticastDelegateExtensions: Extensions forMulticastDelegates, e.g. to invoke async delegates in a safe fashion.NumberExtensions: Adds extensions for primitive numeric types. For example,ToTechnicalString()convertsintinto culture invariantstring.RandomNumberGeneratorExtensions: Shortcuts for retrieving cryptographically secure random numbers.ServiceCollectionExtensions: Shortcuts to remove implementations from anIServiceCollectioninstance.StringExtensions: Adds common useful extensions to thestringtype, such asSplitByCommas()andContainsLoose().