Class LaneNoteCollection<TNote, TLane>
- Namespace
- ChartTools
- Assembly
- ChartTools.dll
public class LaneNoteCollection<TNote, TLane> : ICollection<TNote>, IReadOnlyList<TNote>, IReadOnlyCollection<TNote>, IEnumerable<TNote>, IEnumerable where TNote : LaneNote<TLane>, new() where TLane : struct, Enum
Type Parameters
TNoteTLane
- Inheritance
-
LaneNoteCollection<TNote, TLane>
- Implements
-
ICollection<TNote>IReadOnlyList<TNote>IReadOnlyCollection<TNote>IEnumerable<TNote>
- Inherited Members
- Extension Methods
Constructors
LaneNoteCollection(bool)
public LaneNoteCollection(bool openExclusivity)
Parameters
openExclusivitybool
Properties
Count
Gets the number of elements contained in the ICollection<T>.
public int Count { get; }
Property Value
- int
The number of elements contained in the ICollection<T>.
this[int]
Gets the note at a given index based on order or addition.
public TNote this[int index] { get; }
Parameters
Property Value
- TNote
Note at the index
Exceptions
this[TLane]
Gets the note matching a given lane.
public TNote? this[TLane lane] { get; }
Parameters
laneTLaneLane of the note
Property Value
- TNote
Note with the lane if present, otherwise null.
OpenExclusivity
If true, trying to combine an open note with other notes will remove the current ones.
public bool OpenExclusivity { get; }
Property Value
Methods
Add(TNote)
Adds a note to the LaneNoteCollection<TNote, TLane>.
public void Add(TNote note)
Parameters
noteTNoteNote to add
Remarks
Adding a note that already exists will overwrite the existing note.
If OpenExclusivity is true, combining an open note with other notes will remove the current ones.
Add(TLane)
public void Add(TLane lane)
Parameters
laneTLane
AddRange(params ReadOnlySpan<TNote>)
public void AddRange(params ReadOnlySpan<TNote> notes)
Parameters
notesReadOnlySpan<TNote>
AddRange(params ReadOnlySpan<TLane>)
public void AddRange(params ReadOnlySpan<TLane> notes)
Parameters
notesReadOnlySpan<TLane>
Clear()
Removes all notes from the LaneNoteCollection<TNote, TLane>.
public void Clear()
Contains(byte)
Determines if any note matches a given index.
public bool Contains(byte index)
Parameters
indexbyte
Returns
Contains(TNote)
Determines if any note matches the lane of a given note.
public bool Contains(TNote note)
Parameters
noteTNote
Returns
Exceptions
Contains(TLane)
Determines if any note matches a given lane.
public bool Contains(TLane lane)
Parameters
laneTLane
Returns
CopyTo(TNote[], int)
Copies the elements of the ICollection<T> to an Array, starting at a particular Array index.
public void CopyTo(TNote[] array, int arrayIndex)
Parameters
arrayTNote[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndexto the end of the destinationarray.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<TNote> GetEnumerator()
Returns
- IEnumerator<TNote>
An enumerator that can be used to iterate through the collection.
Remove(byte)
Removes the note that matches a given index.
public bool Remove(byte index)
Parameters
indexbyte
Returns
Remove(TNote)
Removes the note that matches the lane of a given note.
public bool Remove(TNote note)
Parameters
noteTNote
Returns
Remove(TLane)
Removes the note that matches a given lane.
public bool Remove(TLane lane)
Parameters
laneTLane