summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core/NumericExtensions.cs
blob: 6333c3607affdf68c7c76f084f1936d7f48f8bf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
using System;

namespace Xamarin.Forms
{
	internal static class NumericExtensions
	{
		public static double Clamp(this double self, double min, double max)
		{
			return Math.Min(max, Math.Max(self, min));
		}

		public static int Clamp(this int self, int min, int max)
		{
			return Math.Min(max, Math.Max(self, min));
		}
	}
}