Handy Extension Methods
I'm a fan of these guys... (Though I feel like I might catch some flack for the first one.)public static bool IsNullOrEmpty(this ICollection collection){ return collection == null || collection.Count == 0;}public static float Clamp(this float value, float low, float hi){...
I'm a fan of these guys... (Though I feel like I might catch some flack for the first one.)
public static bool IsNullOrEmpty<T>(this ICollection<T> collection)
{
return collection == null || collection.Count == 0;
}
public static float Clamp(this float value, float low, float hi)
{
System.Diagnostics.Debug.Assert(low < hi);
value = (value < low) ? low : value;
return (value > hi) ? hi : value;
}