This is the IsLargerThan generic extension method, this extension method which is part of the Fesslersoft.Extensions. It should only work with numeric values.


Sample C#

public static bool IsLargerThan<TOne, TTwo>(this TOne baseValue, TTwo checkValue) where TOne : struct,IComparable,IComparable<TOne>,IConvertible,IEquatable<TOne>,IFormattable
																				  where TTwo : struct,IComparable,IComparable<TTwo>,IConvertible,IEquatable<TTwo>,IFormattable
	return Convert.ToDouble(baseValue) > Convert.ToDouble(checkValue);

Sample VB.NET

<System.Runtime.CompilerServices.Extension> _
Public Shared Function IsLargerThan(Of TOne As {Structure, IComparable, IComparable(Of TOne), IConvertible, IEquatable(Of TOne), IFormattable}, TTwo As {Structure, IComparable, IComparable(Of TTwo), IConvertible, IEquatable(Of TTwo), IFormattable})(baseValue As TOne, checkValue As TTwo) As Boolean
	Return Convert.ToDouble(baseValue) > Convert.ToDouble(checkValue)
End Function

If you have any questions or suggestions feel free to rate this snippet, post a comment or Contact Us via Email.

Related links:

Leave a Reply