Common

A .NET Standard class library providing common generic and helper methods useful in most applications

External Links:

Extensions

List Extensions

  • ApplyAction
    Apply an Action to each item in the List using a throttling size
    public async static Task ApplyAction(this IList collection, Action actionToTakeOnEach, int throttleSize)
  • ApplyFunction
    Apply a Function to each item in the List using a throttling size and return the results
    public async static Task> ApplyFunction(this IList collection, Func funcToTakeOnEach, int throttleSize)
  • ToCommaDelimited
    Return a comma-delimited row of the contents of this List
    public static string ToCommaDelimited(this List collection, bool useQuotes = false)
  • TryFindAll
    Find all matching items in a generic List using a predicate
    public static bool TryFindAll(this List list, out IList foundList, params Predicate[] predicates)
  • TryFindItem
    Find an Item in a generic List using a predicate
    public static bool TryFindItem(this List list, Predicate predicate, out T found) where T:class
  • TryFindValue
    Find an Value in a generic List using a predicate
    public static bool TryFindValue(this List list, Predicate predicate, out T found) where T : struct

Object Extensions

  • GetAssemblyVersion
    Get the Version of the Assembly where the class of an object exists
    public static string GetAssemblyVersion(this object obj)
  • CastAs
    Safely cast an object as another object
    public static bool CastAs(this object inObject, out ToType output) where ToType : class
  • ThrowIfNull
    Throw ArgumentNullException with name if an object is Null
    public static void ThrowIfNull(this object obj, string argName)
  • ThrowIfNull
    Throw ArgumentNullException if an object is Null
    public static void ThrowIfNull(this object obj)

Generics

  • AbstractAmbassador - IAmbassador
    Interface and abstract class generically implementing the Ambassador design pattern
  • AbstractCircuitBreaker - ICircuitBreaker
    Interface and abstract class generically implementing the CircuitBreaker design pattern
  • AbstractFilter - IFilterAndPipe
    Interface and abstract class generically implementing the Pipes and Filters design pattern
  • DelegateMessageBus - IDelegateMessageBus
    Message bus to push messages to delegates as subscribing events
  • GenericServiceLoader - IServiceLoader
    Service loader implementation inspired from the Java implementation. (uses DynamicServiceAttribute)
  • GenericSpooler - IGenericSpooler
    Asynchronous spooler generically implemented and delegate based
  • Helpers
    Static class for generic method implementations as helper methods

Feature Toggles

"Feature toggles is a well-known pattern (or, rather, a set of patterns) for controlling how new functionality is delivered to the users. In a way, feature toggles are just glorified conditionals, but with an easy way to switch between “on” and “off”." - from: Feature toggles in .NET: tips and tricks, See the Martin Fowler article also.

  • ToggleProvider - IToggleProvider
    Feature Toggles provider for implementing toggling in .Net applications
  • Toggle - IToggle
    Data class for a Toggle
  • DefaultToggleRepository - IToggleRepository
    Repository class to provide access to toggles