If you need a IsLargerThan extension method you can use the follwing snippet.

Sample C#

public static bool IsLargerThan(this byte input, byte numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this sbyte input, sbyte numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this short input, short numberToCheck)
{
	return input > numberToCheck;
}
public static bool IsLargerThan(this ushort input, ushort numberToCheck)
{
	return input > numberToCheck;
}
public static bool IsLargerThan(this int input, int numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this uint input, uint numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this long input, long numberToCheck)
{
	return input > numberToCheck;
}
public static bool IsLargerThan(this ulong input, ulong numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this float input, float numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this double input, double numberToCheck)
{
	return input > numberToCheck;
}

public static bool IsLargerThan(this decimal input, decimal numberToCheck)
{
	return input > numberToCheck;
}

>h2>Sample VB.NET>/h2>

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Byte, numberToCheck As Byte) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As SByte, numberToCheck As SByte) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Short, numberToCheck As Short) As Boolean
	Return input > numberToCheck
End Function
<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As UShort, numberToCheck As UShort) As Boolean
	Return input > numberToCheck
End Function
<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Integer, numberToCheck As Integer) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As UInteger, numberToCheck As UInteger) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Long, numberToCheck As Long) As Boolean
	Return input > numberToCheck
End Function
<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As ULong, numberToCheck As ULong) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Single, numberToCheck As Single) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Double, numberToCheck As Double) As Boolean
	Return input > numberToCheck
End Function

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(input As Decimal, numberToCheck As Decimal) As Boolean
	Return input > numberToCheck
End Function

One thought on “IsLargerThan extension method for C# and VB.NET”

Leave a Reply