Class TimeToLive
- Namespace
- Codebelt.SharedKernel
- Assembly
- Codebelt.SharedKernel.dll
Represents a TimeToLive (TTL) object that can be used when issuing authentication tokens or similar.
public record TimeToLive : ComparableValueObject<TimeSpan>, IEquatable<ValueObject>, IEquatable<SingleValueObject<TimeSpan>>, IComparisonOperators<ComparableValueObject<TimeSpan>, ComparableValueObject<TimeSpan>, bool>, IEqualityOperators<ComparableValueObject<TimeSpan>, ComparableValueObject<TimeSpan>, bool>, IEquatable<ComparableValueObject<TimeSpan>>, IEquatable<TimeToLive>
- Inheritance
-
objectTimeToLive
- Implements
- Inherited Members
-
SingleValueObject<TimeSpan>.GetHashCode()SingleValueObject<TimeSpan>.Equals(object)SingleValueObject<TimeSpan>.Equals(ValueObject)SingleValueObject<TimeSpan>.Equals(SingleValueObject<TimeSpan>)SingleValueObject<TimeSpan>.<Clone>$()SingleValueObject<TimeSpan>.EqualityContract
Remarks
Constructors
TimeToLive(TimeSpan)
Initializes a new instance of the TimeToLive class.
public TimeToLive(TimeSpan value)
Parameters
valueTimeSpanThe TimeSpan value to assign the role of TimeToLive.
Exceptions
- ArgumentOutOfRangeException
valuecannot be less than MinValue -or-valuecannot exceed MaxValue.
Fields
MaxValue
Denotes the largest possible value of TimeToLive.
public static readonly TimeSpan MaxValue
Field Value
MinValue
Denotes the smallest possible value of TimeToLive.
public static readonly TimeSpan MinValue
Field Value
Methods
FromDays(double)
Returns a TimeToLive that represents a specified number of days.
public static TimeToLive FromDays(double value)
Parameters
valuedoubleA number of days.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value.
FromHours(double)
Returns a TimeToLive that represents a specified number of hours.
public static TimeToLive FromHours(double value)
Parameters
valuedoubleA number of hours.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value.
FromMinutes(double)
Returns a TimeToLive that represents a specified number of minutes.
public static TimeToLive FromMinutes(double value)
Parameters
valuedoubleA number of minutes.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value.
FromMonths(int)
Returns a TimeToLive that represents a specified number of months.
public static TimeToLive FromMonths(int value)
Parameters
valueintA number of months.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value.
FromYears(int)
Returns a TimeToLive that represents a specified number of years.
public static TimeToLive FromYears(int value)
Parameters
valueintA number of years.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value.
ToString()
Returns a string> that represents this instance.
public override string ToString()
Returns
Operators
implicit operator TimeSpan(TimeToLive)
Performs an implicit conversion from TimeToLive to TimeSpan.
public static implicit operator TimeSpan(TimeToLive value)
Parameters
valueTimeToLiveThe value to convert.
Returns
implicit operator TimeToLive(TimeSpan)
Performs an implicit conversion from TimeSpan to TimeToLive.
public static implicit operator TimeToLive(TimeSpan value)
Parameters
valueTimeSpanThe value to convert.
Returns
- TimeToLive
A TimeToLive that is equivalent to
value.