KickStart is a collection of useful reusable functions which are too small to be have its own library.
Objects.ToStringHelper
a port of Guava'sMoreObjects.ToStringHelper
which is helpful to implementToString
methodTimeUnits
is a port of Java'sjava.util.concurrent.TimeUnit
originally written by Doug Lea as part of JSR-166Optional<T>
is an immutable object that may contain a non-null reference of typeT
. This ports Java'sjava.util.Optional
Trace.Here()
returns a trace object which contains the line number, method name and file name where the method is called
Combinations
generates cartesian product based on inputs, e.g.:
var combinations = new Combinations<int>(new[] {1, 2, 3}, new[] {2, 3, 4});
/// Generates list of: [[1,2],[1,3],[1,4],[2,2],[2,3],[2,4],[3,2],[3,3],[3,4]]
HashBasedTable
implementsITable
, which is a collection which associates an ordered pair of keys with a value. This implementation is based on nestedDictionary
and it is not multi thread safe.
A port of Guava Cache into C#. More details at here.
A C# port of Coda Hale's Metrics library https://github.com/dropwizard/metrics.
AddRange
adds multiple items to aICollection<T>
SetRange
adds or replaces multiple items in aICollection<T>
orIList<T>
RemoveRange
removes multiple keys from a dictionaryRemoveByValue
removes keys from a dictionary by a valueGetOrDefault
gets value from dictionary, returns the default value if key is not foundToHashSet
adds all the item in anIEnumerable<T>
into a newHashSet<T>
IndexOf
to find the index of an item in a list using anIEqualityComparer<T>
ToDelimitedString
to convert some items into a delimited stringIndexBy
to convertIEnumerable<T>
into a newDictionary<K, T>
keyed by key selectorFunc<T, K>
IsEmpty
andIsNotEmpty
checks if aIList
is empty or notSplit
splits aIList
based on aPredicate
All<T>(this IEnumerable<T> source, Func<T, int, bool> predicate)
extendsAll
to access indexAny<T>(this IEnumerable<T> source, Func<T, int, bool> predicate)
extendsAny
to access indexParse
returns items from the IEnumerable that can be transformed into a different type via a delegate, e.g.int.TryParse
Attempt
returns a sequence of a result, where each result can be the result of applying a function, or the exception that occurred when applying the functionSafeContainsKey
,SafeRemove
,SafeGet
,SafeSet
,SafeAdd
extendsIDictionary<TK, TV>
to apply a safe operation without throwing exceptions
ToStream
converts fromstring
orbyte[]
intostream
StreamToString
converts fromstream
tostring
Print
orP
to print out the object in console
ToListAsync
awaits a task which returnsIEnumerable<T>
and returnsList<T>
TimeoutAfter
awaits a task to return or timeout passedDontWait
indicates don't wait for completion of the task is intentionallyContinueWhenCancelled
ignoresTaskCancelledException
when task is cancelled
Schedule
executes a one-shot action after a given delayScheduleAtFixedRate
executes a periodic action firstly after the given initial delay and subsequently with the given periodScheduleAtFixedDelay
executes a periodic action firstly after the given initial delay and subsequently with the given delay