TimeRange

Field: static readonly TimeRange Default

The default value for TimeRange. The start time is the smallest Time value. The end time is the largest Time value.

    TimeRange.Default; //00:00:00 - 23:59:59

Method: static TimeRange Parse(String)

The method that converts the time range value of the string type to the TimeRange type. The start and end times in the value must be Parseable to Time type.

    TimeRange timeRange = TimeRange.Parse("123030-154512"); //12:30:30 - 15:45:12
Parameter Name Description
timeRangeString time-range object in string type

Error Type: ArgumentNullException (This error is thrown if the value is set null.)

Error Type: FormatException (This error is thrown if the value is not in the format hhmmss-hhmmss, it is discarded .)


Constructor(Int32, Int32)

The TimeRange object is created with the start and end time given in the int type. The minute and second values ​​of the result are zero (0).

    new TimeRange(2,15); //02:00:00 - 15:00:00
    new TimeRange(16,15); //RangeException<TimeRange>
Parameter Name Description
startHour start hour in int type
endHour end hour in int type

Error Type: !:RangeException (This error is thrown if the start time is greater than the end time.)


Constructor(Int32, Int32, Int32, Int32)

The TimeRange object consists of the start and end hour and minute information given in the type int. The seconds value of the output is zero (0).

    new TimeRange(2,30,15,45); //02:30:00 - 15:45:00
    new TimeRange(15,46,15,45); //RangeException<TimeRange>
Parameter Name Description
startHour start hour in int type
startMinute start minute in int type
endHour end hour in int type
endMinute end minute in int type

Error Type: !:RangeException (This error is thrown if the start time is greater than the end time.)


Constructor(Int32, Int32, Int32, Int32, Int32, Int32)

The TimeRange object consists of the start and end hour, minute and second information given in the type int.

    new TimeRange(2,30,45,15,45,25); //02:30:45 - 15:45:25
    new TimeRange(15,45,35,15,45,30); //RangeException<TimeRange>
Parameter Name Description
startHour start hour in int type
startMinute start minute in int type
startSecond start second in int type
endHour end hour in int type
endMinute end minute in int type
endSecond end second in int type

Error Type: !:RangeException (This error is thrown if the start time is greater than the end time.)


Property: Time Start

Returns the start time of the value


            new TimeRange(new Time(12, 10, 0), new Time(12, 11, 0)).Start; //12:10:00

Property: Time End

Returns the end time of the value


            new TimeRange(new Time(12, 10, 0), new Time(12, 11, 0)).End; //12:11:00

Method: bool Contains(Time)

Returns true if the value is in the time range, false otherwise.

If the value is equal to start time or end time, it is accepted in range.

    new TimeRange(12, 10, 0, 12, 10, 0).Contains(new Time(12, 10, 0)); //true
    new TimeRange(12, 9, 59, 12, 10, 0).Contains(new Time(12, 10, 0)); //true
    new TimeRange(12, 10, 0, 12, 10, 1).Contains(new Time(12, 10, 0)); //true
    new TimeRange(12, 9, 59, 12, 10, 1).Contains(new Time(12, 10, 0)); //true

    new TimeRange(12, 9, 59, 12, 10, 1).Contains(new Time(12, 9, 58)); //false
    new TimeRange(12, 9, 59, 12, 10, 1).Contains(new Time(12, 10, 2)); //false
Parameter Name Description
date Time object in Time type

Method: string ToString()

The value is returned in string type and in hhmmss-hhmmss format.

    new TimeRange(new Time(12, 10, 0), new Time(12, 11, 0)).ToString(); //"121000-121100"

Method: bool Equals(Object)

Returns true if the given object has the same value as the TimeRange object and the data, false otherwise.

Parameter Name Description
obj Object to be compared

Method: bool Equals(TimeRange)

Returns true if the given TimeRange object has the same value as the data, false otherwise.

Parameter Name Description
other The object of type TimeRange to be compared