|
4 | 4 | using System.Collections.Generic; |
5 | 5 | using System.Diagnostics; |
6 | 6 | using System.Linq; |
7 | | -using System.Xml.Linq; |
8 | 7 |
|
9 | 8 | namespace Melanchall.DryWetMidi.Interaction |
10 | 9 | { |
@@ -50,6 +49,10 @@ internal TimedObjectsCollection(IEnumerable<TObject> objects, TimedObjectsCompar |
50 | 49 | /// </summary> |
51 | 50 | public int Count => _objects.Count; |
52 | 51 |
|
| 52 | + /// <summary> |
| 53 | + /// Gets a value indicating whether the <see cref="TimedObjectsCollection{TObject}"/> |
| 54 | + /// is read-only. |
| 55 | + /// </summary> |
53 | 56 | public bool IsReadOnly => false; |
54 | 57 |
|
55 | 58 | #endregion |
@@ -175,13 +178,52 @@ public void Clear() |
175 | 178 | OnObjectsRemoved(removedObjects); |
176 | 179 | } |
177 | 180 |
|
178 | | - public bool Contains(TObject item) |
| 181 | + /// <summary> |
| 182 | + /// Determines whether the <see cref="TimedObjectsCollection{TObject}"/> contains a |
| 183 | + /// specific object. |
| 184 | + /// </summary> |
| 185 | + /// <param name="obj">The object to locate in the <see cref="TimedObjectsCollection{TObject}"/>.</param> |
| 186 | + /// <returns><c>true</c> if the object is found; otherwise, <c>false</c>.</returns> |
| 187 | + public bool Contains(TObject obj) |
179 | 188 | { |
180 | | - return _objects.Contains(item); |
| 189 | + return _objects.Contains(obj); |
181 | 190 | } |
182 | 191 |
|
| 192 | + |
| 193 | + /// <summary> |
| 194 | + /// Copies the objects of the <see cref="TimedObjectsCollection{TObject}"/> to an |
| 195 | + /// array, starting at a particular index. |
| 196 | + /// </summary> |
| 197 | + /// <param name="array">The one-dimensional array that is the destination of the objects |
| 198 | + /// copied from <see cref="TimedObjectsCollection{TObject}"/>. The array must have |
| 199 | + /// zero-based indexing.</param> |
| 200 | + /// <param name="arrayIndex">The zero-based index in array at which copying begins.</param> |
| 201 | + /// <exception cref="ArgumentNullException"><paramref name="array"/> is <c>null</c>.</exception> |
| 202 | + /// <exception cref="ArgumentOutOfRangeException"> |
| 203 | + /// One of the following errors occurred: |
| 204 | + /// <list type="bullet"> |
| 205 | + /// <item> |
| 206 | + /// <description><paramref name="arrayIndex"/> is less than zero or greater than the length of the array.</description> |
| 207 | + /// </item> |
| 208 | + /// <item> |
| 209 | + /// <description>The number of elements in the <see cref="TimedObjectsCollection{TObject}"/> is greater than |
| 210 | + /// the available space from the <paramref name="arrayIndex"/> to the end of the <paramref name="array"/>.</description> |
| 211 | + /// </item> |
| 212 | + /// </list> |
| 213 | + /// </exception> |
183 | 214 | public void CopyTo(TObject[] array, int arrayIndex) |
184 | 215 | { |
| 216 | + ThrowIfArgument.IsNull(nameof(array), array); |
| 217 | + ThrowIfArgument.IsInvalidIndex( |
| 218 | + nameof(arrayIndex), |
| 219 | + arrayIndex, |
| 220 | + array.Length); |
| 221 | + ThrowIfArgument.IsLessThan( |
| 222 | + nameof(array), |
| 223 | + array.Length - arrayIndex, |
| 224 | + Count, |
| 225 | + "The number of elements in the source collection is greater than the available space from the index to the end of the destination array."); |
| 226 | + |
185 | 227 | _objects.CopyTo(array, arrayIndex); |
186 | 228 | } |
187 | 229 |
|
|
0 commit comments