public ColumnIdentifier this[int index] { get { // not checking disposal here as it could be accessed, post visible disposal, via a DynamicRowRange var actualWidth = Count; if (index >= actualWidth) { Throw.ArgumentOutOfRangeException(nameof(index), index, actualWidth); } var actualIx = index; if (Offset.HasValue) { actualIx += Offset ?? 0; } string?colName = null; if (Row.HasNames) { var names = Row.Names; if (index < names.Length) { colName = names[actualIx]; } } // use apparent index, not actual index return(ColumnIdentifier.CreateInner(index, colName, null)); } }
internal object GetIndex(int index) { AssertNotDisposed(); if (!TryGetIndex(index, out var ret)) { Throw.ArgumentOutOfRangeException(nameof(index), index, Width); } return(ret); }
void ICollection <T> .CopyTo(T[] array, int arrayIndex) { Utils.CheckArgumentNull(array, nameof(array)); if (arrayIndex < 0) { Throw.ArgumentOutOfRangeException(nameof(arrayIndex), arrayIndex, 0, array.Length); } if (arrayIndex + Data.Count > array.Length) { Throw.ArgumentException(nameof(arrayIndex), $"Collection contains {Data.Count} elements, which will not fit in array of Length {array.Length} starting at index {arrayIndex}"); } // not looking to optimize this, because we don't really care about // this interface... but need it for LINQ to play ball for (var i = 0; i < Data.Count; i++) { array[i + arrayIndex] = GetAt(i); } }