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
TNote
TLane
- 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
openExclusivity
bool
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
lane
TLaneLane 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
note
TNoteNote 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
lane
TLane
Clear()
Removes all items from the ICollection<T>.
public void Clear()
Exceptions
- NotSupportedException
The ICollection<T> is read-only.
Contains(byte)
Determines if any note matches a given index.
public bool Contains(byte index)
Parameters
index
byte
Returns
Contains(TNote)
Determines if any note matches the lane of a given note.
public bool Contains(TNote note)
Parameters
note
TNote
Returns
Exceptions
Contains(TLane)
Determines if any note matches a given lane.
public bool Contains(TLane lane)
Parameters
lane
TLane
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
array
TNote[]The one-dimensional Array that is the destination of the elements copied from ICollection<T>. The Array must have zero-based indexing.
arrayIndex
intThe zero-based index in
array
at which copying begins.
Exceptions
- ArgumentNullException
array
is null.- ArgumentOutOfRangeException
arrayIndex
is less than 0.- ArgumentException
The number of elements in the source ICollection<T> is greater than the available space from
arrayIndex
to 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
index
byte
Returns
Remove(TNote)
Removes the note that matches the lane of a given note.
public bool Remove(TNote note)
Parameters
note
TNote
Returns
Remove(TLane)
Removes the note that matches a given lane.
public bool Remove(TLane lane)
Parameters
lane
TLane