Search Results for

    Show / Hide Table of Contents

    Class MathTimeSpan

    Represents a result of summation or subtraction of two ITimeSpan.
    Inheritance
    object
    MathTimeSpan
    Implements
    ITimeSpan
    IComparable
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.Interaction
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class MathTimeSpan : ITimeSpan, IComparable

    Properties

    Mode

    Get the mode of the mathematical operation represented by the current MathTimeSpan.
    Declaration
    public TimeSpanMode Mode { get; }
    Property Value
    Type Description
    TimeSpanMode

    Operation

    Gets the mathematical operation between TimeSpan1 and TimeSpan2.
    Declaration
    public MathOperation Operation { get; }
    Property Value
    Type Description
    MathOperation

    TimeSpan1

    Gets the first ITimeSpan.
    Declaration
    public ITimeSpan TimeSpan1 { get; }
    Property Value
    Type Description
    ITimeSpan

    TimeSpan2

    Gets the second ITimeSpan.
    Declaration
    public ITimeSpan TimeSpan2 { get; }
    Property Value
    Type Description
    ITimeSpan

    Methods

    Add(ITimeSpan, TimeSpanMode)

    Adds a time span to the current one.
    Declaration
    public ITimeSpan Add(ITimeSpan timeSpan, TimeSpanMode mode)
    Parameters
    Type Name Description
    ITimeSpan timeSpan Time span to add to the current one.
    TimeSpanMode mode Mode of the operation that defines meaning of time spans the operation will be performed on.
    Returns
    Type Description
    ITimeSpan Time span that is a sum of the timeSpan and the current time span.
    Remarks
    If timeSpan and the current time span have the same type, the result time span will be of this type too; otherwise - of the MathTimeSpan.
    Exceptions
    Type Condition
    ArgumentNullException timeSpan is invalid.
    InvalidEnumArgumentException mode specified an invalid value.

    Clone()

    Clones the current time span.
    Declaration
    public ITimeSpan Clone()
    Returns
    Type Description
    ITimeSpan Copy of the current time span.

    CompareTo(object)

    Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
    Declaration
    public int CompareTo(object other)
    Parameters
    Type Name Description
    object other An object to compare with this instance.
    Returns
    Type Description
    int

    A value that indicates the relative order of the objects being compared. The return value has these meanings:

    ValueMeaning
    Less than zeroThis instance precedes other in the sort order.
    ZeroThis instance occurs in the same position in the sort order as other.
    Greater than zeroThis instance follows other in the sort order.

    Divide(double)

    Shrinks the current time span by dividing its length by the specified divisor.
    Declaration
    public ITimeSpan Divide(double divisor)
    Parameters
    Type Name Description
    double divisor Divisor to shrink the time span by.
    Returns
    Type Description
    ITimeSpan Time span that is the current time span shrinked by the divisor.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException divisor is zero or negative.

    Equals(object)

    Determines whether the specified object is equal to the current object.
    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj The object to compare with the current object.
    Returns
    Type Description
    bool true if the specified object is equal to the current object; otherwise, false.
    Overrides
    object.Equals(object)

    GetHashCode()

    Returns the hash code for this instance.
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int A 32-bit signed integer hash code.
    Overrides
    object.GetHashCode()

    Multiply(double)

    Stretches the current time span by multiplying its length by the specified multiplier.
    Declaration
    public ITimeSpan Multiply(double multiplier)
    Parameters
    Type Name Description
    double multiplier Multiplier to stretch the time span by.
    Returns
    Type Description
    ITimeSpan Time span that is the current time span stretched by the multiplier.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException multiplier is negative.

    Subtract(ITimeSpan, TimeSpanMode)

    Subtracts a time span from the current one.
    Declaration
    public ITimeSpan Subtract(ITimeSpan timeSpan, TimeSpanMode mode)
    Parameters
    Type Name Description
    ITimeSpan timeSpan Time span to subtract from the current one.
    TimeSpanMode mode Mode of the operation that defines meaning of time spans the operation will be performed on.
    Returns
    Type Description
    ITimeSpan Time span that is a difference between the timeSpan and the current time span.
    Remarks
    If timeSpan and the current time span have the same type, the result time span will be of this type too; otherwise - of the MathTimeSpan.
    Exceptions
    Type Condition
    ArgumentNullException timeSpan is invalid.
    InvalidEnumArgumentException mode specified an invalid value.

    ToString()

    Returns a string that represents the current object.
    Declaration
    public override string ToString()
    Returns
    Type Description
    string A string that represents the current object.
    Overrides
    object.ToString()

    Operators

    operator ==(MathTimeSpan, MathTimeSpan)

    Determines if two MathTimeSpan objects are equal.
    Declaration
    public static bool operator ==(MathTimeSpan timeSpan1, MathTimeSpan timeSpan2)
    Parameters
    Type Name Description
    MathTimeSpan timeSpan1 The first MathTimeSpan to compare.
    MathTimeSpan timeSpan2 The second MathTimeSpan to compare.
    Returns
    Type Description
    bool true if time spans are equal, false otherwise.

    operator !=(MathTimeSpan, MathTimeSpan)

    Determines if two MathTimeSpan objects are not equal.
    Declaration
    public static bool operator !=(MathTimeSpan timeSpan1, MathTimeSpan timeSpan2)
    Parameters
    Type Name Description
    MathTimeSpan timeSpan1 The first MathTimeSpan to compare.
    MathTimeSpan timeSpan2 The second MathTimeSpan to compare.
    Returns
    Type Description
    bool false if time spans are equal, true otherwise.

    Implements

    ITimeSpan
    IComparable

    Extension Methods

    TimeSpanUtilities.IsZeroTimeSpan(ITimeSpan)
    TimeSpanUtilities.Round(ITimeSpan, TimeSpanRoundingPolicy, long, ITimeSpan, TempoMap)
    In this article
    Back to top 2024 / Generated by DocFX