david-harris submitted these extension methods

  • SafeInvoke

    Properly invokes an action if it is required. Best way to handle events and threaded operations on a form.
    C# System.Control David Harris
  • EnqueueWithCapacity

    Sometimes you may need a Queue<T> that, once it hits a capacity, dequeues items automatically to maintain a certain maximum. While it may be best to derive a new type from Queue<T>, this will get it done much more quickly. This is very useful for maintaining a rolling average or a "history" feature.
    C# System.Collections.Generic.Queue<T> David Harris
  • ConstrainToRange

    Many times you may wish to impose boundaries on what a certain variable can be. This is especially useful for validating user input. For any comparable, it simply returns the value, truncated by a minimum or maximum
    C# System.IComparable<T> David Harris

 

;