From 3e3c168987ba235ecb05079ed86e0ad3b6fe0dc8 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Sat, 22 Dec 2012 17:04:53 -0800 Subject: Add helper routine Util.InRange() --- OpenSim/Framework/Util.cs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'OpenSim/Framework/Util.cs') diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 0c657c5..ea2d28a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -299,6 +299,13 @@ namespace OpenSim.Framework x; } + // Inclusive, within range test (true if equal to the endpoints) + public static bool InRange(T x, T min, T max) + where T : IComparable + { + return x.CompareTo(max) <= 0 && x.CompareTo(min) >= 0; + } + public static uint GetNextXferID() { uint id = 0; -- cgit v1.1