C# 循环

C#循环

代码

csharp 复制代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Test
    {
        static void Main(string[] args)
        {
            int a = 5;
            int[] b = { 1, 2, 3, 4, 5, 6, 7, 8 };
            int c = 0;
            for (int i = 0; i < a; i++)
            {
                Console.WriteLine("i:" + i);
            }
            foreach (var item in b)
            {
                Console.WriteLine("b[" + c++ +"]:" + item);
            }
            Console.ReadLine();
        }
    }
}

运行结果

相关推荐
冰茶_8 小时前
WPF之TextBox控件详解
学习·microsoft·微软·c#·wpf
大飞pkz12 小时前
【Unity】使用XML进行数据读存的简单例子
xml·unity·c#·游戏引擎·游戏开发·数据读写
编程乐趣16 小时前
基于C#开发的适合Windows开源文件管理器
开发语言·windows·c#
code_shenbing18 小时前
C# 实现列式存储数据
开发语言·c#·存储
code_shenbing18 小时前
.NET Core 数据库ORM框架用法简述
数据库·c#·.netcore·orm
ghost14321 小时前
C#学习第20天:垃圾回收
开发语言·学习·c#
code_shenbing1 天前
WPF实现类似Microsoft Visual Studio2022界面效果及动态生成界面技术
ui·c#·wpf·上位机
code_shenbing1 天前
C# 高效操作excel文件
c#·excel·图表
code_shenbing1 天前
C#扩展方法与Lambda表达式基本用法
开发语言·c#·lambda表达式·扩展方法
FAREWELL000751 天前
C#进阶学习(十七)PriorityQueue<TElement, TPriority>优先级队列的介绍
开发语言·学习·c#·优先级队列