ExtensionMethod.NET Home of 876 C#, Visual Basic, F# and Javascript extension methods


Returns a boolean value of true if the item being compared is less than the value of the parameter.


public static bool LessThan<T>(this IComparable<T> comparable, T other)
  return comparable.CompareTo(other) < 0;


var t1 = new Temperature(273);
var t2 = new Temperature(100);

if (t1.LessThan(t2))
  Console.WriteLine("t1 is less than t2");

Author: Richard Bushnell

Submitted on: 3 mrt 2008

Language: C#

Type: System.IComparable<T>

Views: 4766