コード例 #1
0
ファイル: Array2D.cs プロジェクト: 0xCM/arrows
        public override bool Equals(object obj)
        {
            if (!(obj is ArrayBase <T>))
            {
                return(false);
            }
            ArrayBase <T> that = (ArrayBase <T>)obj;

            for (int dimension = 0; dimension < Rank; dimension++)
            {
                if (that.GetLength(dimension) != this.GetLength(dimension))
                {
                    return(false);
                }
            }
            for (int i = 0; i < array.Length; i++)
            {
                T item     = array[i];
                T thatItem = that[i];
                if (!item.Equals(thatItem))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
ファイル: Array2D.cs プロジェクト: 0xCM/arrows
 public void SetToFunction <U>(ArrayBase <U> array, Func <U, T> converter)
 {
     if (array.Count != this.array.Length)
     {
         throw new ArgumentException("array.Count (" + array.Count + ") != this.Count (" + this.Count + ")");
     }
     for (int i = 0; i < array.Count; i++)
     {
         this.array[i] = converter(array[i]);
     }
 }
コード例 #3
0
ファイル: Array2D.cs プロジェクト: 0xCM/arrows
 public void SetToFunction <U, V, W>(ArrayBase <U> array, V[] array2, W[] array3, Func <U, V, W, T> converter)
 {
     if (array.Count != this.array.Length)
     {
         throw new ArgumentException("array.Count (" + array.Count + ") != this.Count (" + this.Count + ")");
     }
     if (array2.Length != this.array.Length)
     {
         throw new ArgumentException("array2.Length (" + array2.Length + ") != this.Count (" + this.Count + ")");
     }
     if (array3.Length != this.array.Length)
     {
         throw new ArgumentException("array3.Length (" + array3.Length + ") != this.Count (" + this.Count + ")");
     }
     for (int i = 0; i < array.Count; i++)
     {
         this.array[i] = converter(array[i], array2[i], array3[i]);
     }
 }