0
点赞
收藏
分享

微信扫一扫

C# 代码

草原小黄河 2022-03-14 阅读 91
c#linqwpf
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++)
            {
        
举报

相关推荐

C# 代码合集

C# 代码优化策略

C# 登录界面代码

C#基础笔记代码(三)

Java的代码转C#

C#不安全代码

0 条评论