planetdonovan.com
Check whether any IComparable<T> falls within a range.
public static bool Between<T>(this T item, T start, T end) where T : IComparable<T> { return (item.CompareTo(start) >= 0 && item.CompareTo(end) <= 0); }
Tags: C#, Extension Methods
Blog
Related posts
Powered by BlogEngine.NET 1.6.1.0 Base theme by Mads Kristensen This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Donovan Olivier
software developer, architect, husband, father, son, brother, uncle, nephew, sinistral, enquirer, skeptic, cynic, anarchist, contrarian, infidel, dissident, rebel, troublemaker, dissenter, renegade.