Search Results for

    Show / Hide Table of Contents

    Class ChunksCollection

    Collection of MidiChunk objects.
    Inheritance
    object
    ChunksCollection
    Implements
    ICollection<MidiChunk>
    IEnumerable<MidiChunk>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class ChunksCollection : ICollection<MidiChunk>, IEnumerable<MidiChunk>, IEnumerable

    Properties

    Count

    Gets the number of chunks contained in the collection.
    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    IsReadOnly

    Gets a value indicating whether the ChunksCollection is read-only.
    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    bool

    this[int]

    Gets or sets the chunk at the specified index.
    Declaration
    public MidiChunk this[int index] { get; set; }
    Parameters
    Type Name Description
    int index The zero-based index of the chunk to get or set.
    Property Value
    Type Description
    MidiChunk The chunk at the specified index.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException index is less than 0; or index is equal to or greater than Count.
    ArgumentNullException value is null.

    Methods

    Add(MidiChunk)

    Adds a chunk to the end of the collection.
    Declaration
    public void Add(MidiChunk chunk)
    Parameters
    Type Name Description
    MidiChunk chunk The chunk to be added to the end of the collection.
    Remarks
    Note that header chunks cannot be added into the collection since it may cause inconsistency in the file structure. Header chunk with appropriate information will be written to a file automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException chunk is null.

    AddRange(IEnumerable<MidiChunk>)

    Adds chunks the end of the collection.
    Declaration
    public void AddRange(IEnumerable<MidiChunk> chunks)
    Parameters
    Type Name Description
    IEnumerable<MidiChunk> chunks Chunks to add to the collection.
    Remarks
    Note that header chunks cannot be added into the collection since it may cause inconsistency in the file structure. Header chunk with appropriate information will be written to a file automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException chunks is null.

    Clear()

    Removes all chunks from the ChunksCollection.
    Declaration
    public void Clear()

    Contains(MidiChunk)

    Determines whether the ChunksCollection contains a specific chunk.
    Declaration
    public bool Contains(MidiChunk item)
    Parameters
    Type Name Description
    MidiChunk item The chunk to locate in the ChunksCollection.
    Returns
    Type Description
    bool true if chunk is found in the ChunksCollection; otherwise, false.

    CopyTo(MidiChunk[], int)

    Copies the elements of the ChunksCollection to an Array, starting at a particular index.
    Declaration
    public void CopyTo(MidiChunk[] array, int arrayIndex)
    Parameters
    Type Name Description
    MidiChunk[] array The one-dimensional Array that is the destination of the elements copied from ChunksCollection. The array must have zero-based indexing.
    int arrayIndex The zero-based index in array at which copying begins.
    Exceptions
    Type Condition
    ArgumentNullException array is null.
    ArgumentOutOfRangeException arrayIndex is less than 0.
    ArgumentException The number of elements in the source ChunksCollection is greater than the available space from arrayIndex to the end of the destination array.

    GetEnumerator()

    Returns an enumerator that iterates through the ChunksCollection.
    Declaration
    public IEnumerator<MidiChunk> GetEnumerator()
    Returns
    Type Description
    IEnumerator<MidiChunk> An enumerator for the ChunksCollection.

    IndexOf(MidiChunk)

    Searches for the specified chunk and returns the zero-based index of the first occurrence within the entire ChunksCollection.
    Declaration
    public int IndexOf(MidiChunk chunk)
    Parameters
    Type Name Description
    MidiChunk chunk The chunk to locate in the ChunksCollection.
    Returns
    Type Description
    int The zero-based index of the first occurrence of chunk within the entire ChunksCollection, if found; otherwise, –1.
    Exceptions
    Type Condition
    ArgumentNullException chunk is null.

    Insert(int, MidiChunk)

    Inserts a chunk into the collection at the specified index.
    Declaration
    public void Insert(int index, MidiChunk chunk)
    Parameters
    Type Name Description
    int index The zero-based index at which the chunk should be inserted.
    MidiChunk chunk The chunk to insert.
    Remarks
    Note that header chunks cannot be inserted into the collection since it may cause inconsistency in the file structure. Header chunk with appropriate information will be written to a file automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException chunk is null.
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • index is less than 0.
    • index is greater than Count.

    InsertRange(int, IEnumerable<MidiChunk>)

    Inserts a set of chunks into the collection at the specified index.
    Declaration
    public void InsertRange(int index, IEnumerable<MidiChunk> chunks)
    Parameters
    Type Name Description
    int index The zero-based index at which the chunk should be inserted.
    IEnumerable<MidiChunk> chunks The chunk to insert.
    Remarks
    Note that header chunks cannot be inserted into the collection since it may cause inconsistency in the file structure. Header chunk with appropriate information will be written to a file automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException chunks is null.
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • index is less than 0.
    • index is greater than Count.

    Remove(MidiChunk)

    Removes the first occurrence of a specific chunk from the collection.
    Declaration
    public bool Remove(MidiChunk chunk)
    Parameters
    Type Name Description
    MidiChunk chunk The chunk to remove from the collection. The value cannot be null.
    Returns
    Type Description
    bool true if chunk is successfully removed; otherwise, false. This method also returns false if chunk was not found in the collection.
    Exceptions
    Type Condition
    ArgumentNullException chunk is null.

    RemoveAll(Predicate<MidiChunk>)

    Removes all the chunks that match the conditions defined by the specified predicate.
    Declaration
    public int RemoveAll(Predicate<MidiChunk> match)
    Parameters
    Type Name Description
    Predicate<MidiChunk> match The Predicate<T> delegate that defines the conditions of the chunks to remove.
    Returns
    Type Description
    int The number of chunks removed from the ChunksCollection.
    Exceptions
    Type Condition
    ArgumentNullException match is null.

    RemoveAt(int)

    Removes the chunk at the specified index of the collection.
    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    int index The zero-based index of the chunk to remove.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException index is less than 0; or index is equal to or greater than Count.

    Implements

    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    CsvSerializer.SerializeToCsv(IEnumerable<MidiChunk>, Stream, TempoMap, CsvSerializationSettings, ObjectType, ObjectDetectionSettings)
    CsvSerializer.SerializeToCsv(IEnumerable<MidiChunk>, string, bool, TempoMap, CsvSerializationSettings, ObjectType, ObjectDetectionSettings)
    In this article
    Back to top 2024 / Generated by DocFX