using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 计算1到100的和_List集合与DataTable_
{
public partial class Form1 : Form
{
public static int List1To100()
{
int result = 0;
List<int> list = new List<int>();
for (int i = 1; i <= 100; i++)
list.Add(i);
for (int i = 0; i < list.Count; i++)
result += list[i];
return result;
}
public static int DataTable1To100()
{
int result = 0;
DataTable dt = new DataTable();
dt.Columns.Add("Value", typeof(int));//添加列
for (int i = 1; i <= 100; i++)
{