Search Results for

    Show / Hide Table of Contents

    Class LengthConverter

    Provides a way to convert the length of an object from one representation to another. More info in the Time and length article.
    Inheritance
    object
    LengthConverter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Interaction
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public static class LengthConverter

    Methods

    ConvertFrom(ITimeSpan, ITimeSpan, TempoMap)

    Converts length from the specified length type to long.
    Declaration
    public static long ConvertFrom(ITimeSpan length, ITimeSpan time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    long Length as long.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • time is null.
    • tempoMap is null.

    ConvertFrom(ITimeSpan, long, TempoMap)

    Converts length from the specified length type to long.
    Declaration
    public static long ConvertFrom(ITimeSpan length, long time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    long Length as long.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • tempoMap is null.

    ConvertTo(ITimeSpan, TimeSpanType, ITimeSpan, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static ITimeSpan ConvertTo(ITimeSpan length, TimeSpanType lengthType, ITimeSpan time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    TimeSpanType lengthType Type that will represent the length of an object.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of time span defined by lengthType.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • time is null.
    • tempoMap is null.
    InvalidEnumArgumentException lengthType specified an invalid value.

    ConvertTo(ITimeSpan, TimeSpanType, long, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static ITimeSpan ConvertTo(ITimeSpan length, TimeSpanType lengthType, long time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    TimeSpanType lengthType Type that will represent the length of an object.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of time span defined by lengthType.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • tempoMap is null.
    InvalidEnumArgumentException lengthType specified an invalid value.

    ConvertTo(ITimeSpan, Type, ITimeSpan, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static ITimeSpan ConvertTo(ITimeSpan length, Type lengthType, ITimeSpan time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    Type lengthType Type to convert length to.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of lengthType.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • lengthType is null.
    • time is null.
    • tempoMap is null.
    NotSupportedException lengthType is not supported.

    ConvertTo(ITimeSpan, Type, long, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static ITimeSpan ConvertTo(ITimeSpan length, Type lengthType, long time, TempoMap tempoMap)
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    Type lengthType Type to convert length to.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of lengthType.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • lengthType is null.
    • tempoMap is null.
    ArgumentOutOfRangeException time is negative.
    NotSupportedException lengthType is not supported.

    ConvertTo(long, TimeSpanType, ITimeSpan, TempoMap)

    Converts length from long to the specified length type.
    Declaration
    public static ITimeSpan ConvertTo(long length, TimeSpanType lengthType, ITimeSpan time, TempoMap tempoMap)
    Parameters
    Type Name Description
    long length Length to convert.
    TimeSpanType lengthType Type that will represent the length of an object.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of time span defined by lengthType.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException length is negative.
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • tempoMap is null.
    InvalidEnumArgumentException lengthType specified an invalid value.

    ConvertTo(long, TimeSpanType, long, TempoMap)

    Converts length from long to the specified length type.
    Declaration
    public static ITimeSpan ConvertTo(long length, TimeSpanType lengthType, long time, TempoMap tempoMap)
    Parameters
    Type Name Description
    long length Length to convert.
    TimeSpanType lengthType Type that will represent the length of an object.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    ITimeSpan Length as an instance of time span defined by lengthType.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • length is negative.
    • time is negative.
    ArgumentNullException tempoMap is null.
    InvalidEnumArgumentException lengthType specified an invalid value.

    ConvertTo<TTimeSpan>(ITimeSpan, ITimeSpan, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static TTimeSpan ConvertTo<TTimeSpan>(ITimeSpan length, ITimeSpan time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    TTimeSpan Length as an instance of TTimeSpan.
    Type Parameters
    Name Description
    TTimeSpan Type that will represent the length of an object.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • time is null.
    • tempoMap is null.
    NotSupportedException TTimeSpan is not supported.

    ConvertTo<TTimeSpan>(ITimeSpan, long, TempoMap)

    Converts length from one length type to another one.
    Declaration
    public static TTimeSpan ConvertTo<TTimeSpan>(ITimeSpan length, long time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
    Parameters
    Type Name Description
    ITimeSpan length Length to convert.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    TTimeSpan Length as an instance of TTimeSpan.
    Type Parameters
    Name Description
    TTimeSpan Type that will represent the length of an object.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException

    One of the following errors occurred:

    • length is null.
    • tempoMap is null.
    NotSupportedException TTimeSpan is not supported.

    ConvertTo<TTimeSpan>(long, ITimeSpan, TempoMap)

    Converts length from long to the specified length type.
    Declaration
    public static TTimeSpan ConvertTo<TTimeSpan>(long length, ITimeSpan time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
    Parameters
    Type Name Description
    long length Length to convert.
    ITimeSpan time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    TTimeSpan Length as an instance of TTimeSpan.
    Type Parameters
    Name Description
    TTimeSpan Type that will represent the length of an object.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException length is negative.
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • tempoMap is null.
    NotSupportedException TTimeSpan is not supported.

    ConvertTo<TTimeSpan>(long, long, TempoMap)

    Converts length from long to the specified length type.
    Declaration
    public static TTimeSpan ConvertTo<TTimeSpan>(long length, long time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
    Parameters
    Type Name Description
    long length Length to convert.
    long time Start time of an object to convert length of.
    TempoMap tempoMap Tempo map used to convert length.
    Returns
    Type Description
    TTimeSpan Length as an instance of TTimeSpan.
    Type Parameters
    Name Description
    TTimeSpan Type that will represent the length of an object.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • length is negative.
    • time is negative.
    ArgumentNullException tempoMap is null.
    NotSupportedException TTimeSpan is not supported.
    In this article
    Back to top 2024 / Generated by DocFX