Browse Source

Extract throw exception method

pull/4104/head
Rustam Sayfutdinov 6 years ago
parent
commit
b206298d53
  1. 10
      src/Avalonia.Base/Utilities/MathUtilities.cs

10
src/Avalonia.Base/Utilities/MathUtilities.cs

@ -1,5 +1,4 @@
using System; using System;
using System.Runtime.InteropServices;
namespace Avalonia.Utilities namespace Avalonia.Utilities
{ {
@ -190,7 +189,7 @@ namespace Avalonia.Utilities
{ {
if (min > max) if (min > max)
{ {
throw new ArgumentException($"{min} cannot be greater than {max}."); ThrowCannotBeGreaterThanException(min, max);
} }
if (val < min) if (val < min)
@ -251,7 +250,7 @@ namespace Avalonia.Utilities
{ {
if (min > max) if (min > max)
{ {
throw new ArgumentException($"{min} cannot be greater than {max}."); ThrowCannotBeGreaterThanException(min, max);
} }
if (val < min) if (val < min)
@ -267,5 +266,10 @@ namespace Avalonia.Utilities
return val; return val;
} }
} }
private static void ThrowCannotBeGreaterThanException(double min, double max)
{
throw new ArgumentException($"{min} cannot be greater than {max}.");
}
} }
} }

Loading…
Cancel
Save