Extension Methods from Fons Sonnemans
-
Pivot
Groups the elements of a sequence according to a specified firstKey selector function and rotates the unique values from the secondKey selector function into multiple values in the output, and performs aggregations.
-
AddRange<T>()
I have created this AddRange<T>() method on ObservableCollection<T> because the LINQ Concat() method didn't trigger the CollectionChanged event. This method does.
-
ToObservableCollection<T>()
Convert a IEnumerable<T> to a ObservableCollection<T> and can be used in XAML (Silverlight and WPF) projects
-
Storyboard.BeginAsync()
Begin an XAML Storyboard using the async/await pattern instead of using the completed event.
-
IndexOf<T>()
Returns the index of the first occurrence in a sequence by using the default equality comparer or a specified one.
-
IsPrime
Returns true when a integer is a prime.
-
SetCookie(), GetCookie(), DeleteCookie()
Extension methods on HtmlDocument used to read, write and delete cookies in Silverlight applications.
-
ToString
Concatenates a specified separator String between each element of a specified enumeration, yielding a single concatenated string.
-
GetValueOrDefault<T> for DbDataReader
Helper method to retrieve a nullable value of a column from a datareader.
-
Popup.ShowAsync()
Show an XAMP Popup using the async/await pattern instead of using the completed event.
-
Append() and Prepend()
Append() adds a value to the end of the sequence. Prepend() adds a value to the beginning of the sequence. This is usefull if you are not using .NET Core or .NET Framework 4.7.
-
ToColor
Convert a (A)RGB string to a Silverlight Color object
-
SetInputScope
Set the InputScope of TextBox on a Windows 7 Phone.
-
FirstIndex() and LastIndex()
Finds the index of the first of last occurence which matches the predicate.
-
First(), Last(), Any()
Helper methods to simplify development. Prevent common LINQ performance mistakes.
-
GetPermutations
GetPermutations
-
Chooser.ShowAsync()
Show Windows Phone Choosers using the async/await pattern instead of using the completed event.
-
WriteToConsole
Write all elements in the Enumeration to the Console
-
FirstOrNothing
Returns the first element of a sequence, or a nullable value which has no value if no element is found.
-
FindMin() and FindMax()
Selects the object in a list with the minimum or maximum value on a particular property
-
SetInitialFocus
Set the initial focus for a Silverlight ChildWindow.
-
SplitNext
Split the next part of this span with the given separator
-
ToList(capacity)
LINQ ToList() extension method with an extra capacity argument. This can boost the speed of creating the list.
-
InsertSorted
Insert an item to a sorted List
-
Right
Returns a string containing a specified number of characters from the right side of a string
-
FillSpan
Fill any Span using an IEnumerable. Returns the number of items which are placed in the Span.
-
All() and Any() on Array and List<T>
Faster implementations of the LINQ All() and Any() methods for Array and List<T>. This solution uses less memory allocations and is just faster. Temporary solution until this PR is accepted https://github.com/dotnet/runtime/pull/1832
-
ForEachRef
Performs the specified action on each ValueType in the List<T> without copying it.
-
AnyAndAll
Determines whether a sequence contains any elements and whether all elements of a sequence satisfy a condition. The normal 'All' method returns true when the sequence is empty.
-
EnumerateWithIndex<T>()
Enumerate an IEnumerable<T> source and getting the Index and the Item returned in a ValueTuple.
-
Fluent DateOnly Extensions
A fluent way to create DateOnly values.
-
Dictionary<K,V>.GetValueOrDefault()
If you attempt to get a value from a dictionary using a key that doesn't exist, it throws a KeyNotFoundException. But this extension method to return a default value when the key doesn't exist. Also supports an overload with a Lazy initialization of the fallback value.
-
SkipFrom
Bypasses a specified number of elements in a sequence from a given start position