Class FromToT<T>
- Namespace
- SunamoData.Data
- Assembly
- SunamoData.dll
Generic range type with start and end values of type T. Contains parsing and formatting methods for time ranges.
public class FromToT<T> where T : struct
Type Parameters
TThe struct type for the range values.
- Inheritance
-
FromToT<T>
- Derived
- Inherited Members
- Extension Methods
Constructors
FromToT()
Initializes a new instance of the FromToT<T> class.
public FromToT()
FromToT(T, T, FromToUseData)
Initializes a new instance with the specified range values.
public FromToT(T from, T to, FromToUseData fromToUse = FromToUseData.DateTime)
Parameters
fromTThe start value of the range.
toTThe end value of the range.
fromToUseFromToUseDataHow to interpret the values (DateTime for date/time, None for plain numbers).
Properties
From
Gets or sets the start value of the range.
public T From { get; set; }
Property Value
- T
FromLong
Gets the start value as a long integer.
public long FromLong { get; }
Property Value
FromToUse
Gets or sets how to interpret the range values (DateTime, Unix time, or None).
public FromToUseData FromToUse { get; set; }
Property Value
IsEmpty
Gets or sets whether this instance is empty.
public bool IsEmpty { get; set; }
Property Value
To
Gets or sets the end value of the range.
public T To { get; set; }
Property Value
- T
ToLong
Gets the end value as a long integer.
public long ToLong { get; }
Property Value
Methods
IsFilledWithData()
Checks whether this instance contains valid parsed data.
public bool IsFilledWithData()
Returns
- bool
True if the instance has valid data, false otherwise.
Parse(string)
Parses a time range string in format "HH:mm-HH:mm" or "HH:mm". After parsing, IsFilledWithData can be called to check if data was successfully parsed.
public void Parse(string text)
Parameters
textstringThe time range string to parse.
ToString()
Returns a string representation of this range based on the FromToUse setting.
public override string ToString()
Returns
- string
A string representation of the range.
ToStringDateTime()
Converts this range to a DateTime string representation. Override this method in derived classes to provide custom formatting.
protected virtual string ToStringDateTime()
Returns
- string
A DateTime string representation.