Extension Methods from James Michael Hare (BlackRabbitCoder)
-
ToDictionary() - for enumerations of groupings
Converts an IEnumerable
> to a Dictionary > so that you can easily convert the results of a GroupBy clause to a Dictionary of Groupings. The out-of-the-box ToDictionary() LINQ extension methods require a key and element extractor which are largely redundant when being applied to an enumeration of groupings, so this is a short-cut.
-
GetAttribute
Gets the first assembly attribute of the specified type from the assembly it is called from.
-
IsNullable
Returns true if the type it is called upon is a System.Nullable<> wrapped type.
-
Mask
A set of extension methods that make it easy to mask a string (to protect account numbers or other personal data).
For example, you could mask a SSN of 123456789 to be ******789.
-
TakeUntil
The opposite of TakeWhile, inverts the expression and passes to TakeWhile so that instead of taking while an expression is true, you take until an expression is true.
-
IsDefault
Returns true if the object it is called upon is the default of its type. This will be null for referece types, zero for integer types, and a default-initialized struct for structs.
-
ToDictionary()
Converts an IEnumerable
> from a GroupBy() clause to a Dictionary >. -
GetAttributes
Gets an enumeration of assembly attributes of the specified type from the assembly it is called from.
-
Repeat
Repeats a character a given number of times, a little cleaner shortcut than using the string constructor.