public Matrix(int width, int height, T[] dictionary, TraverseOrientation traverseOrientation) { Width = width; Height = height; Data = new T[Width, Height]; _traverseOrientation = traverseOrientation; Populate(dictionary, _traverseOrientation); }
private void Populate(T[] dictionary, TraverseOrientation traverseOrientation) { switch (traverseOrientation) { case TraverseOrientation.TopToBottom: var currentDictionaryIndex = 0; var dictionaryLength = dictionary.Length; for (var i = 0; i < Width; i++) { for (var j = 0; j < Height; j++) { T item = dictionary[currentDictionaryIndex % dictionaryLength]; Data[i, j] = item; currentDictionaryIndex++; } } break; } }