GemBox.Presentation
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    TimeOffset Struct

    Namespace:
    GemBox.Presentation.Media
    Assembly:
    GemBox.Presentation.dll

    Represents an amount of time.

    • C#
    • VB.NET
    public struct TimeOffset : IComparable<TimeOffset>, IEquatable<TimeOffset>, IFormattable
    Public Structure TimeOffset
        Implements IComparable(Of TimeOffset), IEquatable(Of TimeOffset), IFormattable
    Implements
    System.IComparable<TimeOffset>
    System.IEquatable<TimeOffset>
    System.IFormattable

    Properties

    DefaultUnit

    Gets or sets the default time unit that is applied globally every time TimeOffset is converted from/to a System.Double.

    • C#
    • VB.NET
    public static TimeOffsetUnit DefaultUnit { get; set; }
    Public Shared Property DefaultUnit As TimeOffsetUnit
    Property Value
    TimeOffsetUnit

    The default time unit.

    Remarks

    Initial value is Millisecond.

    This property makes code less verbose and, thus, easier to read and maintain because instead of using From(Double, TimeOffsetUnit) and To(TimeOffsetUnit), one can use implicit conversions from/to a System.Double.

    Since default time unit is applied globally (like any other static member), it is advisable not to set DefaultUnit property or use implicit conversions from/to a System.Double if GemBox.Presentation is used by various application functions that expect different default time unit, especially if usage is multi-threaded.

    Unit

    Gets the unit.

    • C#
    • VB.NET
    public readonly TimeOffsetUnit Unit { get; }
    Public ReadOnly Property Unit As TimeOffsetUnit
    Property Value
    TimeOffsetUnit

    The unit.

    Value

    Gets the value.

    • C#
    • VB.NET
    public readonly double Value { get; }
    Public ReadOnly Property Value As Double
    Property Value
    System.Double

    The value.

    Methods

    CompareTo(TimeOffset)

    Compares the value of this instance to a specified TimeOffset value and returns an integer that indicates whether this instance is earlier than, the same as, or later than the specified TimeOffset value.

    • C#
    • VB.NET
    public int CompareTo(TimeOffset other)
    Public Function CompareTo(other As TimeOffset) As Integer
    Parameters
    other
    TimeOffset

    The object to compare to the current instance.

    Returns
    System.Int32

    A signed number indicating the relative values of this instance and the other parameter.

    If returned value is less than zero, then this instance is earlier than other; else, if it is zero, then this instance is the same as other; else (if it is greater than zero) this instance is later than other.

    Equals(TimeOffset)

    Determines whether the other TimeOffset is equal to this TimeOffset instance.

    • C#
    • VB.NET
    public bool Equals(TimeOffset other)
    Public Function Equals(other As TimeOffset) As Boolean
    Parameters
    other
    TimeOffset

    The other time offset to compare with this time offset instance.

    Returns
    System.Boolean

    true if the other TimeOffset is equal to this TimeOffset instance; otherwise, false.

    Equals(Object)

    Determines whether the specified System.Object is equal to this TimeOffset instance.

    • C#
    • VB.NET
    public override bool Equals(object obj)
    Public Overrides Function Equals(obj As Object) As Boolean
    Parameters
    obj
    System.Object

    The System.Object to compare with this time offset instance.

    Returns
    System.Boolean

    true if the specified System.Object is a TimeOffset and is equal to this TimeOffset instance; otherwise, false.

    Overrides
    System.ValueType.Equals(System.Object)

    From(Double, TimeOffsetUnit)

    Converts a time amount value in a specified time unit to a TimeOffset instance.

    Negative value is automatically coerced to zero.

    • C#
    • VB.NET
    public static TimeOffset From(double value, TimeOffsetUnit unit)
    Public Shared Function From(value As Double, unit As TimeOffsetUnit) As TimeOffset
    Parameters
    value
    System.Double

    The time amount value.

    unit
    TimeOffsetUnit

    The time unit.

    Returns
    TimeOffset

    A TimeOffset instance that is equivalent to a specified input time amount in a specified time unit.

    GetHashCode()

    Returns a hash code for this TimeOffset instance.

    • C#
    • VB.NET
    public override int GetHashCode()
    Public Overrides Function GetHashCode As Integer
    Returns
    System.Int32

    An integer value that specifies a hash value for this TimeOffset instance.

    Overrides
    System.ValueType.GetHashCode()

    To(TimeOffsetUnit)

    Converts this TimeOffset instance to an another TimeOffset instance with the specified time unit.

    • C#
    • VB.NET
    public TimeOffset To(TimeOffsetUnit unit)
    Public Function To(unit As TimeOffsetUnit) As TimeOffset
    Parameters
    unit
    TimeOffsetUnit

    The time unit.

    Returns
    TimeOffset

    A TimeOffset instance that is equivalent to this TimeOffset instance in a specified time unit.

    ToString()

    Returns a System.String that represents this TimeOffset instance.

    • C#
    • VB.NET
    public override string ToString()
    Public Overrides Function ToString As String
    Returns
    System.String

    A System.String that represents this TimeOffset instance.

    Overrides
    System.ValueType.ToString()

    ToString(String, IFormatProvider)

    Returns a System.String that represents this TimeOffset instance in a specified format by using a specified format provider.

    • C#
    • VB.NET
    public string ToString(string format, IFormatProvider formatProvider)
    Public Function ToString(format As String, formatProvider As IFormatProvider) As String
    Parameters
    format
    System.String

    The format.

    formatProvider
    System.IFormatProvider

    The format provider.

    Returns
    System.String

    A System.String that represents this TimeOffset instance in a specified format by using a specified format provider.

    Operators

    Equality(TimeOffset, TimeOffset)

    Determines whether first and second TimeOffsets are equal.

    • C#
    • VB.NET
    public static bool operator ==(TimeOffset first, TimeOffset second)
    Public Shared Operator =(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first and second time offsets are equal; otherwise, false.

    GreaterThan(TimeOffset, TimeOffset)

    Determines whether first TimeOffset is later than second TimeOffset.

    • C#
    • VB.NET
    public static bool operator>(TimeOffset first, TimeOffset second)
    Public Shared Operator>(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first time offset is later than second time offset; otherwise, false.

    GreaterThanOrEqual(TimeOffset, TimeOffset)

    Determines whether first TimeOffset is later than or equal to second TimeOffset.

    • C#
    • VB.NET
    public static bool operator >=(TimeOffset first, TimeOffset second)
    Public Shared Operator >=(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first time offset is later than or equal to second time offset; otherwise, false.

    Implicit(TimeOffset to Double)

    Converts a TimeOffset instance to a time amount value in a DefaultUnit.

    • C#
    • VB.NET
    public static implicit operator double (TimeOffset value)
    Public Shared Widening Operator CType(value As TimeOffset) As Double
    Parameters
    value
    TimeOffset

    The time offset value.

    Returns
    System.Double

    A time amount value that is equivalent to a specified input TimeOffset instance in a DefaultUnit.

    Implicit(Double to TimeOffset)

    Converts a time amount value in a DefaultUnit to a TimeOffset instance.

    • C#
    • VB.NET
    public static implicit operator TimeOffset(double value)
    Public Shared Widening Operator CType(value As Double) As TimeOffset
    Parameters
    value
    System.Double

    The time amount value.

    Returns
    TimeOffset

    A TimeOffset instance that is equivalent to a specified input time amount in a DefaultUnit.

    Inequality(TimeOffset, TimeOffset)

    Determines whether first and second TimeOffsets are not equal.

    • C#
    • VB.NET
    public static bool operator !=(TimeOffset first, TimeOffset second)
    Public Shared Operator <>(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first and second time offsets are not equal; otherwise, false.

    LessThan(TimeOffset, TimeOffset)

    Determines whether first TimeOffset is earlier than second TimeOffset.

    • C#
    • VB.NET
    public static bool operator <(TimeOffset first, TimeOffset second)
    Public Shared Operator <(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first time offset is earlier than second time offset; otherwise, false.

    LessThanOrEqual(TimeOffset, TimeOffset)

    Determines whether first TimeOffset is earlier than or equal to second TimeOffset.

    • C#
    • VB.NET
    public static bool operator <=(TimeOffset first, TimeOffset second)
    Public Shared Operator <=(first As TimeOffset, second As TimeOffset) As Boolean
    Parameters
    first
    TimeOffset

    The first time offset.

    second
    TimeOffset

    The second time offset.

    Returns
    System.Boolean

    true if first time offset is earlier than or equal to second time offset; otherwise, false.

    Implements

    System.IComparable<T>
    System.IEquatable<T>
    System.IFormattable
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.