17 lines
411 B
C#
17 lines
411 B
C#
|
using System;
|
|||
|
|
|||
|
namespace Utility
|
|||
|
{
|
|||
|
public static class TimeSpanExtension
|
|||
|
{
|
|||
|
public static bool IsBetween(this TimeSpan value, TimeSpan start, TimeSpan end)
|
|||
|
{
|
|||
|
if (start > end)
|
|||
|
{
|
|||
|
throw new ArgumentException(nameof(start), "start must be before end.");
|
|||
|
}
|
|||
|
|
|||
|
return value >= start && value <= end;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|