i have these two duplicated methods as extension methods , but i want to condense them into only one extension method ,
i have thought of using constraint : Where T : Struct ,
but then what about bool , other struct types , is there a way to limit only to int decimal float long etc.
public static bool IsBetween(this double value, double lowerBound, double upperBound)
{
return value >= lowerBound && value <= upperBound;
}
public static bool IsBetween(this decimal value, decimal lowerBound, decimal upperBound)
{
return value >= lowerBound && value <= upperBound;
}