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 class 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
-
ObjectSingleValueObject<TimeSpan>ComparableValueObject<TimeSpan>TimeToLive
- Implements
-
IEquatable<ValueObject>IEquatable<TimeToLive>
- Inherited Members
-
SingleValueObject<TimeSpan>.PrintMembers(StringBuilder)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
value
TimeSpanThe System.TimeSpan value to assign the role of TimeToLive.
Exceptions
- System.ArgumentOutOfRangeException
value
cannot be less than MinValue -or-value
cannot exceed MaxValue.
Fields
MaxValue
Denotes the largest possible value of TimeToLive.
public static readonly TimeSpan MaxValue
Field Value
- TimeSpan
MinValue
Denotes the smallest possible value of TimeToLive.
public static readonly TimeSpan MinValue
Field Value
- TimeSpan
Methods
FromDays(Double)
Returns a TimeToLive that represents a specified number of days.
public static TimeToLive FromDays(double value)
Parameters
value
DoubleA 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
value
DoubleA 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
value
DoubleA number of minutes.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value
.
FromMonths(Int32)
Returns a TimeToLive that represents a specified number of months.
public static TimeToLive FromMonths(int value)
Parameters
value
Int32A number of months.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value
.
FromYears(Int32)
Returns a TimeToLive that represents a specified number of years.
public static TimeToLive FromYears(int value)
Parameters
value
Int32A number of years.
Returns
- TimeToLive
A new instance of TimeToLive that represents
value
.
ToString()
Returns a System.String> that represents this instance.
public override string ToString()
Returns
- String
A System.String> that represents this instance.
Operators
Implicit(TimeToLive to TimeSpan)
Performs an implicit conversion from TimeToLive to System.TimeSpan.
public static implicit operator TimeSpan(TimeToLive value)
Parameters
value
TimeToLiveThe value to convert.
Returns
- TimeSpan
A System.TimeSpan that is equivalent to
value
.
Implicit(TimeSpan to TimeToLive)
Performs an implicit conversion from System.TimeSpan to TimeToLive.
public static implicit operator TimeToLive(TimeSpan value)
Parameters
value
TimeSpanThe value to convert.
Returns
- TimeToLive
A TimeToLive that is equivalent to
value
.