Class TimeOnlyExtensions
- Namespace
- Plugin.BaseTypeExtensions
- Assembly
- Plugin.BaseTypeExtensions.dll
Provides extension methods for TimeOnly operations, such as range checks and percentage calculations.
public static class TimeOnlyExtensions
- Inheritance
-
TimeOnlyExtensions
- Inherited Members
Methods
PercentageToTimeOnly(double, TimeOnly, TimeOnly)
Converts a percentage (0.0 to 1.0) to a TimeOnly value within the specified range.
public static TimeOnly PercentageToTimeOnly(this double percentage, TimeOnly minBound, TimeOnly maxBound)
Parameters
percentage
doubleThe percentage value (0.0 to 1.0)
minBound
TimeOnlyThe minimum bound of the target range
maxBound
TimeOnlyThe maximum bound of the target range
Returns
- TimeOnly
The calculated TimeOnly value within the specified range
Exceptions
- ArgumentOutOfRangeException
Thrown when minBound is greater than maxBound
TimeOnlyToPercentage(TimeOnly, TimeOnly, TimeOnly)
Converts a TimeOnly value within a specified range to a percentage (0.0 to 1.0).
public static double TimeOnlyToPercentage(this TimeOnly value, TimeOnly minBound, TimeOnly maxBound)
Parameters
value
TimeOnlyThe TimeOnly value to convert
minBound
TimeOnlyThe minimum bound of the source range
maxBound
TimeOnlyThe maximum bound of the source range
Returns
- double
The percentage representation (0.0 to 1.0)
Exceptions
- ArgumentOutOfRangeException
Thrown when minBound is greater than maxBound