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

运行结果

相关推荐
djk888820 小时前
一个完整的 TCP 服务器监听示例(C#)
服务器·tcp/ip·c#
虚行1 天前
C#技术栈
开发语言·c#
唐青枫1 天前
C#.NET SqlKata 使用详解:优雅构建动态 SQL 查询
c#·.net
虚行1 天前
C#上位机工程师技能清单文档
开发语言·c#
小白杨树树1 天前
【C++】力扣hot100错误总结
c++·leetcode·c#
Tiger_shl1 天前
三大并发集合ConcurrentDictionary、ConcurrentBag、ConcurrentQueue
开发语言·c#
时光追逐者2 天前
一个使用 WPF 开发的 Diagram 画板工具(包含流程图FlowChart,思维导图MindEditor)
c#·.net·wpf·流程图
我是唐青枫2 天前
C#.NET FluentValidation 全面解析:优雅实现对象验证
c#·.net
YuanlongWang2 天前
C# 设计模式——工厂模式
开发语言·设计模式·c#
时光追逐者2 天前
C#/.NET/.NET Core技术前沿周刊 | 第 58 期(2025年10.13-10.19)
微软·开源·c#·.net·.netcore