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();
        }
    }
}

运行结果

相关推荐
geovindu4 小时前
CSharp: Breadth First Search Algorithm and Depth First Search Algorithm
开发语言·后端·算法·c#·.net·搜索算法
小羊先生car9 小时前
RTOS-F429-HAL-(动/静态)任务的创建(2026/7/27)
开发语言·算法·c#
地球驾驶员10 小时前
NX二次开发C#-获取体的外表面
开发语言·c#
向夏威夷 梦断明暄11 小时前
从 Bun 的 Rust 重写,看 C# 如何重建 AI 基础设施层
人工智能·rust·c#
心平气和量大福大11 小时前
C#-WPF-控件-LiveChart图表-线性2(LineSeries)-数据绑定
开发语言·c#·wpf
code bean1 天前
【C#】 `Channel<T>` 深度解析:生产者-消费者模式的现代解法
数据结构·c#
吴可可1231 天前
C# CAD二次开发:合并首尾重合多段线
c#
EIP低代码平台1 天前
EIP低代码平台 - 应用管理 - 表单设计
低代码·c#·权限·工作流·netcore
czhc11400756631 天前
726:zoffset
c#
向夏威夷 梦断明暄1 天前
C# 弃元模式:从语法糖到性能利器的深度解析
服务器·数据库·c#