Пример #1
0
        private void СуммаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string line = " ";

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                line += dataGridView1[0, i].Value + " ";
            }

            AonedimensionalArray arr = new AonedimensionalArray(line);

            MessageBox.Show($"сумма:{arr.Sum()}", "Сумма", MessageBoxButtons.OK);
        }
Пример #2
0
        private void СуммаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string line = " ";

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                line += dataGridView1[0, i].Value + " ";
            }

            var result = AonedimensionalArray.GetCollectionFromDataGridView(dataGridView1);
            var sum    = AonedimensionalArray.Sum(result);

            MessageBox.Show($"сумма:{sum}", "Сумма", MessageBoxButtons.OK);
        }