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

运行结果

相关推荐
weixin_4219947811 小时前
认识数据 - 变量与数据类型
c#·.net·.netcore
mudtools12 小时前
深入理解飞书 Webhook 签名验证:一次踩坑到填坑的完整记录
网络·c#·.net·飞书
Var_al12 小时前
Unity编辑器扩展:标准化UI组件快速创建工具开发指南
ui·unity·c#·编辑器
FL162386312912 小时前
[C#]winform使用纯opencvsharp部署yolo26-cls图像分类的onnx模型
开发语言·分类·c#
CreasyChan12 小时前
Unity 中的 IEnumerator协程详解
unity·c#·游戏引擎
code bean12 小时前
【C#高级】TCP请求-应答模式的WPF应用实战
tcp/ip·c#·wpf
code bean13 小时前
【C#高级】TCP服务器并发优化与错误处理改进实战
服务器·tcp/ip·c#
Eiceblue13 小时前
【.NET 开发】通过 C# 实现 Excel 转 JSON
c#·.net·excel
王维志1 天前
使用C#控制台批量删除 Unity目录里的 .meta文件
unity·c#·.net
de之梦-御风1 天前
【C#.Net】C#开发的未来前景
开发语言·c#·.net