public Matrix2d(Index2d counts, IEnumerable <T> items)
        {
            if (items == null)
            {
                throw new ArgumentNullException(nameof(items));
            }
            if (counts.X < 0 || counts.Y < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            var array = InputAsArray(items);

            if (array.Length == 0)
            {
                _items = _emptyArray;
                return;
            }
            if (array.Length > counts.X * counts.Y)
            {
                throw new ArgumentException();
            }
            _items  = new T[counts.X, counts.Y];
            _countX = _capacityX = counts.X;
            _countY = _capacityY = counts.Y;
            ArrayExtended.CopySingleToTwoDimensionArray(array, _items);
        }
Example #2
0
 public Intersection2d(Index2d index, T value)
 {
     Value = value;
     Index = index;
 }
 public Matrix2d(Index2d capacities) : this(capacities.X, capacities.Y)
 {
 }
 public T this[Index2d index]
 {
     get => this[index.X, index.Y];
     set => this[index.X, index.Y] = value;